0.0.5 • Published 9 years ago

whereto v0.0.5

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

WhereTo

Express middlewere wrapper for handling .all() requests for node.

    var express = require('express');
    var whereTo = require('whereto');
    var app = express();
    
    app.all('/form', whereTo({
        get: function(req, res) {
            //display a form here
        },
        post: function(req, res) {
            //process form data here
        }
    })
    
    app.listen(8080)

You can also add an options object to your whereTo call. These options will get passed as the 4th parameter in your express middleware.

WhereTo allows you to pass a function instead of an object describing your request methods. If you pass in a function it will be called directly, any options you provided will be delivered to the 4th parameter.

var express = require('express');
var whereTo = require('whereto');
var app = express();

app.get('/test', whereTo(function(req, res, next, options) {
        //do something here
        res.send('option1 = '+options.option1);
    },{ option1: 123 });

app.listen(8080)

Installation

$ npm install whereto
0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago