Background information
I'm working on my first node.js app using express. I have bug somewhere because I can't seem to match up the URI I'm specifying with the URI in my post method.
Code
router.post('/widget/:widgetnum/:rules', function(req, res, next) {
var widgetnum = req.params.widgetnum;
var rules = req.params.rules;
if (debug) { winston.log('info', 'router.post) invoked with : ' + widgetnum)};
if (debug) { winston.log('info', 'router.post) invoked with : ' + rules)};
if (!valid_widget(widgetnum)) {
console.log('trigger 400');
res.status(400).send("Invalid widgetnum");
}
if (rules==null) {
console.log('trigger 400');
res.status(400).send("Invalid Time Conditions");
}
res.send('hello');
});
And the address I'm testing with looks like this:
http://myserver:3000/widget/123123/00:00:00_00:00:00_someothervalue
where I was hoping "123123" would be captured as the "widgetnum" and "00:00:00_00:00:00_someothervalue" as "rule"
I'm sure it's something very basic / simple that I'm missing. Thanks in advance for your time.
EDIT 1
Here's what I see on the commandline - proving that I am sending POST requests...
devserver:/var/www/widgettest# DEBUG=widgettest:* npm start
> widgettest@1.0.0 start /var/www/widgettest
> node ./bin/www
widgettest:server Listening on port 3000 +0ms
POST /widget/11231231234/rules 404 713.167 ms - 1025
POST /widget/11231231234 404 75.216 ms - 1025