I use node express
Router
module, and it's route()
method.
I need to accept an optional parameter, this way:
var express = require('express');
var router = express.Router();
router.route('/verb/:optionalParameter').get(function(req, res, next) {
// ...
}
How do I specify optionalParameter
?
I did try:
router.route('/verb/:optionalParameter*?').get(function(req, res, next) {
and
curl -X GET -H "Accept: application/json" http://localhost:3000/verb/option1
works just fine, but
curl -X GET -H "Accept: application/json" http://localhost:3000/verb
spits a 404...
I'm sure I'm missing something obvious... :-( Any clue?