clode
v0.0.5
Published
Lightweight, Laravel-inspired framework for bootstrapping Node applications
Downloads
2
Readme
Clode
Clode is a lightweight framework for bootstrapping Express
apps.
Installation
npm i clode
Basic usage
router.js
const { Router, fakes } = require('clode');
const { middleware, controller } = fakes;
const AppRouter = new Router();
AppRouter.get('/test', middleware, controller);
const prefix = AppRouter.group('/prefix', middleware);
prefix.get('/test', controller);
prefix.get('/test2', controller);
const another = prefix.group('/another');
another.get('/one', controller);
module.exports = AppRouter;
server.js
const { Server } = require('clode');
const AppRouter = require('./router');
const clode = new Server();
clode.router(AppRouter);
clode.configure(app => {
app.disable('X-Powered-By');
});
clode.listen(3000);
The code here did following thigs:
- Initiated Router
- Created Server instance
- Applied router and disabled
X-Powered-By
header - Started listener on
3000
Console output will be:
🚀 Started listener on 3000!
Documentation
All the documentation on Clode is provided on the wiki page.