Last active
May 15, 2018 00:30
-
-
Save steren/cc16b50cee2f75295ecd3fd45119cf88 to your computer and use it in GitHub Desktop.
Simple Node.js hello world for App Engine standard
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
runtime: nodejs8 |
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
{ | |
"name": "hello-world", | |
"version": "1.0.0", | |
"description": "Oh hi there", | |
"scripts": { | |
"start": "node server.js" | |
}, | |
"author": "Myles Borins <[email protected]>", | |
"license": "Apache-2.0", | |
"dependencies": { | |
"express": "^4.16.2" | |
} | |
} |
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(); | |
app.get('/', (req, res) => { | |
res.send('๐ Hello Node.js on App Engine Standard! ๐'); | |
}); | |
const server = app.listen(process.env.PORT || 8080, () => { | |
const host = server.address().address; | |
const port = server.address().port; | |
console.log(`Example app listening at http://${host}:${port}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment