0.8.5 • Published 7 years ago

line-router v0.8.5

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

line-router

NPM

Simple Router

Install

npm install line-router

Usage

var http = require('http');
var Router = require('line-router');

router = new Router();

router.get('/', async (req, res) => "hello home");
router.get('/test', (req, res) => JSON.stringify(req.params));
router.get('/people/*/posts', async (req, res) => JSON.stringify(req.params));
router.get('/members/<memberId:number>/posts/<postName>', async (req, res) => JSON.stringify(req.params));
router.get('/users/<userId:number>/posts/*', async (req, res) => JSON.stringify(req.params));
router.notfound(async (req, res) => "404");
router.error(async (req, res) => "500");

http.createServer(router.handler).listen(3000);
0.8.5

7 years ago

0.8.1

7 years ago

0.8.0

7 years ago

0.5.0

7 years ago

0.4.0

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.3

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago