Advertisement
Guest User

cache

a guest
Sep 27th, 2021
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. const express = require('express')
  2. const app = express()
  3. const port = 3000
  4.  
  5. const cache = {};
  6. app.post('/', (req, res) => {
  7. const id = req.query.id;
  8. const body = req.body;
  9. if (cache[id]) {
  10. cache[id] = [...cache[id], body]
  11. } else {
  12. cache[id] = [body]
  13. }
  14. res.status(200);
  15. })
  16.  
  17. app.listen(port, () => {
  18. console.log(`Example app listening at http://localhost:${port}`)
  19. })
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement