Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    api-methodspublic

    api methods

    Wrapper for express routing methods to help with versioning apis

    Usage

    var apim = require('api-methods');
    var app = express();
    var api = apim.version(app, '/api', 'v1');
    var api2 = apim.version(app, '/api', 'v2');
     
    api.get('/user', function(){
     
    });
     
    api.post('/user', function(){
     
    });
     
    api2.get('/user', function(){
     
    });

    Since the routes were added using api instead of app, the routes turn out to be

    /api/v1/user
    

    and

    /api/v2/user
    

    Keywords

    none

    install

    npm i api-methods

    Downloadsweekly downloads

    9

    version

    0.0.4

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar