Created
July 11, 2018 09:15
-
-
Save mousetree/72fc4c6331cdccef46ac3a2190bb5c30 to your computer and use it in GitHub Desktop.
Node.js server showing environment variables
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 app = express() | |
/* | |
For the purpose of making the testing easier, we've just put this | |
in a seperate file. | |
*/ | |
const myLib = require('./lib') | |
const commitRef = process.env.APP_COMMIT_REF || 'N/A' | |
const buildDate = process.env.APP_BUILD_DATE || new Date().toISOString() | |
app.get('/', (req, res) => { | |
const welcome = myLib.helloWorld() | |
const text = `${welcome}! We're at commit ${commitRef} which was built at ${buildDate}` | |
res.send(text) | |
}) | |
app.listen(3000, () => console.log('Example app listening on port 3000!')) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment