Skip to content

Instantly share code, notes, and snippets.

@dgaubert
Created December 30, 2022 13:02
Show Gist options
  • Save dgaubert/f23365a17fa81f4fb4927b795c655a9e to your computer and use it in GitHub Desktop.
Save dgaubert/f23365a17fa81f4fb4927b795c655a9e to your computer and use it in GitHub Desktop.
Deferred Fetch

Get started

$ npm i

Run

$ node app.js

Try it

$ culr localhost:3000
const express = require('express')
const app = express()
app.use((req, res) => {
res.end('OK\n')
console.log('response sent')
setTimeout(() => console.log('deferred call done'), 5000)
})
app.listen(3000, () => console.log('Listen on port 3000'))
{
"name": "deferred-fetch",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.18.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment