Reputation: 3706
Is there a good express routing tutorial out there? I'm having a hard time finding anything comprehensive. I'm especially interested in getting variables from routes.
Upvotes: 0
Views: 88
Reputation: 5074
express.js's document under request.params is a starting point. Here is an example how to get params and query string out of a request:
var express = require('express');
var app = express();
app.get('/user/:name', function(req, res){
res.send('hello ' + req.params.name + ', id=' + req.query.id);
});
app.listen(3000);
So GET /user/john?id=123 prints "hello john, id=123"
Upvotes: 1