Skip to content

Instantly share code, notes, and snippets.

@zbicin
Last active August 17, 2022 20:24
Show Gist options
  • Save zbicin/c171392d0328ccf67cc9d23a47338ba7 to your computer and use it in GitHub Desktop.
Save zbicin/c171392d0328ccf67cc9d23a47338ba7 to your computer and use it in GitHub Desktop.
const http = require('http');
const requestListener = function (req, res) {
res.writeHead(200);
res.end(JSON.stringify({ headers: req.headers, cookies: req.cookies }));
}
const server = http.createServer(requestListener);
const port = process.env.ECHO_SERVER_PORT || 8080;
server.listen(port, '0.0.0.0', () => {
console.log(`Echo server listening on port ${port}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment