Skip to content

Instantly share code, notes, and snippets.

@standinga
Created June 14, 2020 21:47
Show Gist options
  • Save standinga/16c45f0b4ba132637fd64f2e30df1a3c to your computer and use it in GitHub Desktop.
Save standinga/16c45f0b4ba132637fd64f2e30df1a3c to your computer and use it in GitHub Desktop.
const express = require('express')
const app = express()
const port = 3000
const recursive = function (req, res) {
counter ++
setTimeout(recursive, 300);
}
recursive()
var counter = 0
app.get('/', (req, res) => {
console.log(`Counter: ${counter}`)
res.set('Cache-Control', 'public, max-age=110')
res.send(`Response: ${counter}`)
})
app.listen(port, ()=> console.log(`listening at http://0.0.0.0:${port}`))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment