Commit 9717c83d100192a6f9540ba1a03e1bde44ee00c6
1 parent
6c4983c792
Exists in
master
express 4!
Showing 1 changed file with 4 additions and 5 deletions Side-by-side Diff
index.js
View file @
9717c83
1 | 1 | var express = require('express'); |
2 | 2 | var app = express(); |
3 | -app.use(express.logger()); | |
4 | 3 | |
4 | +app.set('port', (process.env.PORT || 5000)) | |
5 | 5 | app.get('/', function(request, response) { |
6 | 6 | response.send('Hello World!'); |
7 | 7 | }); |
8 | 8 | |
9 | -var port = process.env.PORT || 5000; | |
10 | -app.listen(port, function() { | |
11 | - console.log("Listening on " + port); | |
9 | +app.listen(app.get('port'), function() { | |
10 | + console.log("Node app is running at localhost:" + app.get('port')); | |
12 | 11 | }); |