nexxusjs
v1.0.0
Published
[![npm package](https://nodei.co/npm/nexxusjs.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/nexxusjs/)
Downloads
1
Maintainers
Readme
nexxusjs
Why
This library is designed to speed server creation and define routes. But I need everyone's contribution to improve the library and grow fast and optimized.
Open a lot of tasks if necessary to improve this. I count on the collaboration of all.
How to use
yarn add nexxusjs
or
npm install --save nexxusjs
Simple express server create.
The server uses by default, cors released to everyone, morgan with 'dev' option and helmet
const nexxusjs = require('nexxusjs');
const default = require('./default/router');
const defaultPostRoute = require('./defaultPostRoute');
new nexxusjs()
.setPort(3000)
.setMiddleware(function (req, res, next) {
console.log("My middleware logic here");
next();
})
.setMasterRout('/api')
.setRoute('/1', default)
.setRouteWithMiddleware('/2', default, function (req, res, next) {
console.log("Middleware logic here");
next();
})
.createRoute('get', 'test', (req, res, next) => {
res.status(200).send("Work").end();
})
.createRoute('post', '/test', defaultPostRoute)
.run()