mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 12:19:51 +01:00
parent
98b0b66b6c
commit
80e64691e1
|
|
@ -69,14 +69,17 @@ var userRepos = {
|
|||
// we now can assume the api key is valid,
|
||||
// and simply expose the data
|
||||
|
||||
// example: http://localhost:3000/api/users/?api-key=foo
|
||||
app.get('/api/users', function(req, res, next){
|
||||
res.send(users);
|
||||
});
|
||||
|
||||
// example: http://localhost:3000/api/repos/?api-key=foo
|
||||
app.get('/api/repos', function(req, res, next){
|
||||
res.send(repos);
|
||||
});
|
||||
|
||||
// example: http://localhost:3000/api/user/tobi/repos/?api-key=foo
|
||||
app.get('/api/user/:name/repos', function(req, res, next){
|
||||
var name = req.params.name;
|
||||
var user = userRepos[name];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user