1.0.22 • Published 3 years ago

pioneers-router v1.0.22

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

a module to route your web-api efficiently!

class Router can handle requests with any id, name, etc

to use Router you must first fix config following here:

config = {
    eventEmitter,
    event,
    routesPattern
}

when custom event emited, request route will check by regex patterns. If request url matches one of the patterns, The Router sends request for midlewares and related handler. else Router returns page not found.

notice that routesPattern is a dicctionary that have keys same as routes.

example:

routes = {
    '/users': { GET: {}, POST: {} },
    '/users/:id': { GET: {}, POST: {}
}
routesPattern = {
    '/users': /(^\/users$)/,
    '/users/:id': /(^\/users\/\d+$)/
}
1.0.19

3 years ago

1.0.17

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.12

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago