The powerful, lightweight HTTP server library for Node
Contents
Install
npm i retra
And then use it!
const Retra =
Usage
Create a server
const app =
Add a simple handler for GET requests
app
Read query string parameters from requests
app
Parse request as JSON
app
Set response headers
Setting one header:
app
Setting many at once:
app
Handle all POST requests to any path
app
/squid
Handle requests using any method to path app
Stream a response
// ... require fs, path app
Make your server listen on port 8080
app
Listen as an HTTPS server
// ... require https https
Handle route errors
app
Official extensions
retra-static
Host static files in your retra server, easily and efficiently.
Install:
npm i retra-static
Use:
// ... require path moduleconst static = app // This will host from the /static directory!