Skip to content

Instantly share code, notes, and snippets.

@yyolk
Created November 24, 2012 19:39
Show Gist options
  • Save yyolk/4141141 to your computer and use it in GitHub Desktop.
Save yyolk/4141141 to your computer and use it in GitHub Desktop.
params + express
var express = require('express');
var params = require('express-params');
/**
* The app.
*/
var app = module.exports = express();
params.extend(app);
app.param('work', /^[0-9a-z-_]+$/);
app.get('/test/:work', function(req, res, next){
var work = req.params.work;
res.send('work '+ work);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment