Created
June 24, 2020 12:35
-
-
Save navneetsaluja/d8e5b845baecbf3bca7d029a87d81b67 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hostname = process.env.HOST; | |
const port = process.env.PORT; | |
app.use((req, res, next) => { | |
console.log(req.headers); | |
res.statusCode = 200; | |
res.setHeader('Content-Type', 'text/html'); | |
res.end('<html><body><h1>This is an Express Server</h1></body></html>'); | |
}); | |
const server = http.createServer(app); | |
server.listen(port, hostname, () => { | |
console.log(`Server running at http://${hostname}:${port}/`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment