Skip to content

Instantly share code, notes, and snippets.

@marcofranssen
Created November 23, 2013 18:29
Show Gist options
  • Save marcofranssen/7618209 to your computer and use it in GitHub Desktop.
Save marcofranssen/7618209 to your computer and use it in GitHub Desktop.
var colors = require('colors');
console.log('Hello '.red + 'Node.js'.green);
var express = require('express'),
http = require('http'),
app = express(),
httpServer = http.createServer(app);
app.configure(function () {
app.set('port', 3000);
app.use(express.static(__dirname + '/public'));
});
httpServer.listen(app.get('port'), function () {
console.log("Express server listening on port %s.", httpServer.address().port);
});
console.log('Hello World');
<html>
<head>
<title>Hello Node.js express webserver</title>
</head>
<body>
<h1>Hello Node.js express webserver</h1>
<p>I have just created my first node.js webserver, serving static content.</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment