Guest User

Untitled

a guest
Jul 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. const express = require('express')
  2.  
  3. const port = 8080
  4. const app = express()
  5. let tasks = []
  6.  
  7. app.use(express.json());
  8.  
  9. app.get('/tasks', (req, res) => {
  10. res.send(tasks)
  11. })
  12.  
  13. app.post('/tasks', (req, res) => {
  14. const task = req.body
  15. tasks.push(req.body)
  16.  
  17. res.send(task)
  18. })
  19.  
  20. app.listen(port)
Add Comment
Please, Sign In to add comment