0.4.35 • Published 1 month ago

@wooksjs/event-http v0.4.35

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

@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:

  1. Never mutate request object (req). Accumulate a request context in a separate object(s) instead (wooks store);
  2. Never parse anything (cookies, body) before it is really requested by the request handler;
  3. Get rid of complex predefined data objects containing everything (cookies, headers, body, parsed body etc.) and use composable functions (hooks) instead;
  4. Get rid of tons of dependencies (middlewares) and implement everything that is needed for web app in a simple way.

Official Wooks HTTP composables:

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.

0.4.35

1 month ago

0.4.33

1 month ago

0.4.34

1 month ago

0.4.31

1 month ago

0.4.32

1 month ago

0.4.30

2 months ago

0.4.28

3 months ago

0.4.29

3 months ago

0.4.27

3 months ago

0.4.26

3 months ago

0.4.25

3 months ago

0.4.24

4 months ago

0.4.23

4 months ago

0.4.22

4 months ago

0.4.20

4 months ago

0.4.21

4 months ago

0.4.19

4 months ago

0.4.18

4 months ago

0.4.17

4 months ago

0.4.15

4 months ago

0.4.16

4 months ago

0.4.14

4 months ago

0.4.13

5 months ago

0.4.12

5 months ago

0.4.10

5 months ago

0.4.11

5 months ago

0.4.9

6 months ago

0.4.8

7 months ago

0.3.8

10 months ago

0.3.7

10 months ago

0.3.9

10 months ago

0.3.12

10 months ago

0.3.11

10 months ago

0.3.10

10 months ago

0.4.5

7 months ago

0.4.4

7 months ago

0.4.7

7 months ago

0.4.6

7 months ago

0.4.1

9 months ago

0.4.0

9 months ago

0.4.3

7 months ago

0.4.2

9 months ago

0.2.23

12 months ago

0.2.22

12 months ago

0.2.21

12 months ago

0.2.20

12 months ago

0.2.19

12 months ago

0.3.0

12 months ago

0.3.6

11 months ago

0.3.5

11 months ago

0.3.2

12 months ago

0.3.1

12 months ago

0.3.4

11 months ago

0.3.3

12 months ago

0.2.16

1 year ago

0.2.15

1 year ago

0.2.14

1 year ago

0.2.18

1 year ago

0.2.17

1 year ago

0.2.13

1 year ago

0.2.12

1 year ago

0.2.11

1 year ago

0.2.10

1 year ago

0.2.9

1 year ago

0.2.8

1 year ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.5

1 year ago

0.2.4

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.1.0

1 year ago