Skip to content

giovannibenussi/extended

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Extended

Handy extensions that returns native Request and Response objects.

Usage

This library provides a lot of utilities, but in the end, all you get is a native Resquest and Response objects to have maximum compatibility with all platforms including CloudFlare Workers, Node.js, and even Service Workers!

const res = new ExtendedResponse()
res.status(500).json({ user: "giovannibenussi" })

In the real world, you'll get an instance of ExtendedResponse provided by your framework of choice, so you'll rarely call the constructor.

You can perform a redirect by calling the .redirect method:

res.redirect('http://giovannibenussitest.com', 307)

As the philosophy of this library, the previous code is equivalent of calling Response.redirect with the added benefit of having utility classes to set headers, cookies, or whatever you want!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published