Last active
October 10, 2017 12:59
-
-
Save allthingsclowd/c2781a67388be4ee89a3e026df38f330 to your computer and use it in GitHub Desktop.
Really simple NodeJS Webserver that returns an image the the servers hostname - used for autoscaling demo
This file contains hidden or 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 app = express() | |
const serverName = require('os').hostname(); | |
const messageTop = '<div class="middle">\ | |
<img src="https://www.fujitsu.com/uk/Images/K5-climber-580x224_tcm23-2619235.jpg" alt="K5 Autoscale">\ | |
<h1>Hello from ' | |
const messageTail = '</h1>\ | |
<hr>\ | |
</div>\ | |
</div>' | |
app.get('/', function (req, res) { | |
res.send(messageTop + serverName + messageTail) | |
}) | |
app.listen(80, function () { | |
console.log('Example app listening on port 80') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment