Showing
1 changed file
with
20 additions
and
0 deletions
express-demo/index.js
0 → 100644
| 1 | +const express = require('express'); | ||
| 2 | +const app = express(); | ||
| 3 | + | ||
| 4 | +// Corespond to HTTP | ||
| 5 | +// app.get() | ||
| 6 | +// app.post() | ||
| 7 | +// app.put(); | ||
| 8 | +// app.delete() | ||
| 9 | + | ||
| 10 | +app.get('/',(req,res)=> { | ||
| 11 | + res.send('Hello World'); | ||
| 12 | +}); | ||
| 13 | + | ||
| 14 | +app.get('/api/courses',(req,res) => { | ||
| 15 | + res.send([1,2,3]); | ||
| 16 | +}); | ||
| 17 | + | ||
| 18 | +app.listen(3000, ()=> console.log("Listening on port 3000")); | ||
| 19 | + | ||
| 20 | + |
-
Please register or login to post a comment