0.1.0 • Published 8 years ago

pugna v0.1.0

Weekly downloads
6
License
MIT
Repository
github
Last release
8 years ago

Pugna

NPM version

An Extensible Node.js Web Architecture

Install

npm i pugna -S

Usage

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 routes folder 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