Neural Prediction Model

    simple-path-router

    1.1.0 • Public • Published

    simple-path-router

    Build Status Coverage Status

    A simple path-only router

    Example

    'use strict';
    
    var PathRouter = require('simple-path-router');
    
    var router = new PathRouter()
        .when('/', serveWeb)
        .when('/api', serveApi);
    
    require('http')
        .createServer(router.dispatch)
        .listen(10000);
    
    function serveWeb (req, res) {
        console.log('web!');
        res.statusCode = 200;
        res.end();
    }
    
    function serveApi (req, res) {
        console.log('api!');
        res.statusCode = 200;
        res.end();
    }
    

    Install

    npm i simple-path-router

    DownloadsWeekly Downloads

    129

    Version

    1.1.0

    License

    MIT

    Last publish

    Collaborators

    • omsmith