Skip to content

Instantly share code, notes, and snippets.

@mh108
Last active August 3, 2017 19:25
Show Gist options
  • Save mh108/6d8a532cadd870098ceb083692b76b18 to your computer and use it in GitHub Desktop.
Save mh108/6d8a532cadd870098ceb083692b76b18 to your computer and use it in GitHub Desktop.
Our First Express Server, p. 192, Learning Web App Dev
var express = require("express"),
http = require("http"),
app;
// Create our Express-powered HTTP server
// and have it listen on port 3000
app = express();
http.createServer(app).listen(3000);
// set up our routes
app.get("/hello", function(req, res) {
res.send("Hello World!");
});
app.get("/goodbye", function(req, res) {
res.send("Goodbye World!");
});
console.log("Server running on port 3000");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment