clode

Lightweight, Laravel-inspired framework for bootstrapping Node applications


Keywords
express, mongorito, server, api
License
MIT
Install
npm install clode@0.0.5

Documentation

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.