UNPKG

flickerjs

Version:

Super fast and simple web framework for node.js (v6.0.0)

36 lines (32 loc) 746 B
const flicker = require('../'); let app = flicker(); app.add(app.serveStatic()); // inherited in renders app.locals.year = 2016; app .add({ url: '/', method: 'GET', handler: [ (req,res,next) => { app.locals.author = "Flicker.js 2"; next(); }, (req,res,next) => { res.render('index',{title: 'Welcome to Flicker.js'}); } ] }) .add({ url: '/user/:id', handler: (req,res,next) => { res.send(req.params.id); } }) .add({ url: '/blog/:blog/cat/:cat', handler: (req,res,next) => { res.json(req.params); } }) .listen(3000);