1.4.8 • Published 5 years ago

aers-custom v1.4.8

Weekly downloads
-
License
ISC
Repository
-
Last release
5 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

5 years ago

1.4.7

5 years ago

1.4.6

5 years ago

1.4.5

5 years ago

1.4.4

5 years ago

1.4.3

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.8

5 years ago

1.3.7

5 years ago

1.3.6

5 years ago

1.3.5

5 years ago

1.3.4

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.9

5 years ago

1.2.8

5 years ago

1.2.7

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago