I_Jemin

Route Parameters

...@@ -15,6 +15,14 @@ app.get('/api/courses',(req,res) => { ...@@ -15,6 +15,14 @@ app.get('/api/courses',(req,res) => {
15 res.send([1,2,3]); 15 res.send([1,2,3]);
16 }); 16 });
17 17
18 +app.get('/api/courses/:id',(req,res) => {
19 + res.send(req.params.id);
20 +});
21 +
22 +app.get('/api/courses/:year/:month',(req,res) => {
23 + res.send(req.query);
24 +});
25 +
18 // PORT 26 // PORT
19 const port = process.env.PORT || 3000; 27 const port = process.env.PORT || 3000;
20 28
......