0.0.5 ā€¢ Published 6 years ago

clode v0.0.5

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

Clode

Build Status

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:

  1. Initiated Router
  2. Created Server instance
  3. Applied router and disabled X-Powered-By header
  4. Started listener on 3000

Console output will be:

šŸš€ Started listener on 3000!

Documentation

All the documentation on Clode is provided on the wiki page.