1.4.8 • Published 6 years ago

aers-custom v1.4.8

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

aers-custom

Autoload Express Routers (custom package)

You can see spesific detail "README" how to use it from previous package at https://www.npmjs.com/package/express-autoload-router

New Custom Features

  1. Adding params on routes controller.
  2. Check available routes with a simple way.

Example

--- How to use it on controllers

exports.show = {
    method: ['GET'],
    params: [':id'],
    handler(req, res) {
        res.status(200).json({
            info: `id = ${req.params.id}`
        }),
    }
}

--- Check available routes

You can set to true on third parameter on loadRouter variable and it will print it to the console once after server is running.

const loadRouter = require('aers-custom')

loadRouter(app, '/api/', path.join(__dirname, '../api/controllers'), true);

// expect output:
// endpoint uri: [ GET ] /blog
// endpoint uri: [ GET ] /blog/show/:id
// endpoint uri: [ POST ] /blog/store
// endpoint uri: [ PATCH ] /blog/update/:id
// endpoint uri: [ DELETE ] /blog/delete/:id

Thanks

Special thanks to ~imcooder who made this package before.

1.4.8

6 years ago

1.4.7

7 years ago

1.4.6

7 years ago

1.4.5

7 years ago

1.4.4

7 years ago

1.4.3

7 years ago

1.4.2

7 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.8

7 years ago

1.3.7

7 years ago

1.3.6

7 years ago

1.3.5

7 years ago

1.3.4

7 years ago

1.3.3

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.9

7 years ago

1.2.8

7 years ago

1.2.7

7 years ago

1.2.5

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago