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

    connect-requirementspublic

    connect-requirements

    Require specific keys in request.

    Usage

    var http = require('http')
    var connect = require('connect')
    var requirements = require('connect-requirements')
     
    var app = connect()
     
    // make sure the objects are added to the request before the request is checked for requirements
        .use(connect.query())
        .use(connect.bodyParser())
     
     
    // you can specify any objects within the request to check for keys
        .use(requirements({ query: 'foo' }))
        .use(requirements({ body: ['bar', 'foobar'] }))
     
        .use(function(req, res){
            res.end('hello world\n');
        })
     
    http.createServer(app).listen(3000);

    Keywords

    none

    install

    npm i connect-requirements

    Downloadslast 7 days

    5

    version

    0.0.3

    license

    none

    last publish

    collaborators

    • avatar