1.3.0 • Published 9 years ago

happyrestfields v1.3.0

Weekly downloads
5
License
ISC
Repository
github
Last release
9 years ago

happyRestFields

Express middleware which extract fields from request

Example :

request : /test?fields=name,mail,address(city)
result : req.happyRest.fields = ["name", "mail", { "address" : ["city"] }]

install

npm install happyrestfields

How to use ?

like all others Express middleware :

Application-level :

var express = require('express') , happyRestFields = require('happyRestFields');

var app = express();

app.use(extractFields());

app.use('/test?fields=name,mail,address(city)', function (req, res, next) { console.log('Fields:', req.happyRest.fields); next(); });

Route-level :

var express = require('express') , happyRestFields = require('happyRestFields');

var router = express.Router();

router.get('/test?fields=name,mail,address(city)', extractFields(), function (req, res, next) { console.log('Fields:', req.happyRest.fields); next(); })

1.3.0

9 years ago

1.2.0

9 years ago

1.1.1

9 years ago

1.0.0

9 years ago