0.1.0 • Published 9 years ago
pugna v0.1.0
Pugna
An Extensible Node.js Web Architecture
Install
npm i pugna -SUsage
Pugna extends Koa2 and you can use it same as Koa:
const Pugna = require('pugna');
const app = new Pugna();
app.use(ctx => {
ctx.body = 'Hello Pugna!';
});loadModules
Pugna provides a function for dynamic loading modules:
app.loadModules(app, __dirname);Appointment
Using loadModules should have the following appointment:
- Use
koa-router - Each module's name would be used in the application's route rules
- Each module should have
routesfolder and exports the router:
const router = require('koa-router')();
router.get('/', (ctx, next) => {
ctx.body = 'bar index';
});
module.exports = router;Example
See example.
License
The MIT License
0.1.0
9 years ago