Last active
July 30, 2022 09:20
-
-
Save kaysush/a2fe226fe5abb3dc7d93aaf33a0458c9 to your computer and use it in GitHub Desktop.
Demo Node.js application for demonstrating Traffic Management in Cloud Run
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
FROM node:18.7.0-alpine3.16 | |
RUN mkdir $HOME/app | |
WORKDIR $HOME/app | |
COPY main.js . | |
CMD ["node", "main.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
var http = require("http") | |
var version = process.env.VERSION || "Default Version" | |
var port = process.env.PORT || 8080 | |
http.createServer(function (request, response) { | |
response.writeHead(200, { "Content-Tye": "text/plain" }); | |
response.end("Hello world from " + version + "\n"); | |
}).listen(port) | |
console.log("Server is running at 0.0.0.0:" + port) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment