@wooksjs/event-http v0.4.35
@wooksjs/event-http
!!! This is work-in-progress library, breaking changes are expected !!!
As a part of wooks
event processing framework, @wooksjs/event-http
implements http events and provides composables that let you:
- parse urls search params
- parse cookies
- parse request body (json, url-encoded, form, ...)
- serve files
The main ideas behind composable functions are:
- Never mutate request object (
req
). Accumulate a request context in a separate object(s) instead (wooks store
); - Never parse anything (cookies, body) before it is really requested by the request handler;
- Get rid of complex predefined data objects containing everything (cookies, headers, body, parsed body etc.) and use composable functions (hooks) instead;
- Get rid of tons of dependencies (middlewares) and implement everything that is needed for web app in a simple way.
Official Wooks HTTP composables:
- @wooksjs/http-body - to parse body
- @wooksjs/http-static - to serve static files
- @wooksjs/http-proxy - to proxy requests
Installation
npm install wooks @wooksjs/event-http
Quick Start
import { useRouteParams } from 'wooks'
import { createHttpApp } from '@wooksjs/event-http'
const app = createHttpApp()
app.on('GET', 'hello/:name', () => `Hello ${useRouteParams().get('name')}!`)
// shortcuts for some methods are supported:
// app.get('hello/:name', () => `Hello ${ useRouteParams().get('name') }!`)
app.listen(3000, () => {
console.log('Wooks Server is up on port 3000')
})
Documentation
To check out docs, visit wooks.moost.org.
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
7 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
7 months ago
7 months ago
7 months ago
7 months ago
9 months ago
9 months ago
7 months ago
9 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
11 months ago
11 months ago
12 months ago
12 months ago
11 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago