Skip to content

Instantly share code, notes, and snippets.

@anonymuse
Created August 17, 2016 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymuse/06af66e183245fdd1eac0e299d237eae to your computer and use it in GitHub Desktop.
Save anonymuse/06af66e183245fdd1eac0e299d237eae to your computer and use it in GitHub Desktop.
Docker Live Debugging app.js
var express = require('express');
var expressHandlebars = require('express-handlebars');
var http = require('http');
var PORT = 8000;
var LINES = [
"Hey, now, you're an All Star, get your game on, go play",
"Hey, now, you're a Rock Star, get the show on, get paid",
"And all that glitters is gold",
"Only shooting stars break the mold",
];
var lineIndex = 0;
var app = express();
app.engine('html', expressHandlebars());
app.set('view engine', 'html');
app.set('views', __dirname);
app.get('/', function(req, res) {
var message = LINES[lineIndex];
lineIndex += 1;
if (lineIndex > LINES.length) {
lineIndex = 0;
}
res.render('index', {message: message});
});
http.Server(app).listen(PORT, function() {
console.log("HTTP server listening on port %s", PORT);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment