Created
January 25, 2023 17:00
-
-
Save stevengonsalvez/5724a0a008e5282a49469a13525de109 to your computer and use it in GitHub Desktop.
default-server-platform-response-api.js
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 express = require('express') | |
const os = require('os') | |
const app = express() | |
const port = process.env.APP_PORT || 80 | |
var response = '<html><body> <h1>' | |
response += 'Hello from' + os.hostname() + '</h1>' | |
response += 'Type:' + os.type() + '<br/>' | |
response += 'Platform: ' + os.platform() + '<br/>' | |
response += 'Arch: ' + os.arch() + '<br/>' | |
response += 'Release: ' + os.release() + '<br/>' | |
response += '</body></html>' | |
app.get('/', (req, res) => res.send(response)) | |
app.listen(port, () => console.log('Example app listening on port!' + port)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment