Permalink
Browse files

update app.js to use server logging and the port as a variable

  • Loading branch information...
1 parent 8f8cfce commit 54aa08877855b64f87ccc60f37a902fb319343b1 @blackfalcon blackfalcon committed Mar 5, 2014
Showing with 12 additions and 4 deletions.
  1. +6 −2 app.js
  2. +6 −2 readme.md
View
@@ -2,6 +2,10 @@
var express = require('express');
var app = express();
var path = require('path');
+var port = 4000;
+
+// Displays server log in the CLI
+app.use(express.logger());
// views as directory for all template files
app.set('views', path.join(__dirname, 'views'));
@@ -18,5 +22,5 @@ app.get('/', function(req, res) {
});
// Set server port
-app.listen(4000);
-console.log('server is running');
+app.listen(port);
+console.log("Server is running at => http://localhost:" + port + "/\nCTRL + C to shutdown");
View
@@ -46,10 +46,14 @@ If you only want to add to this project:
var express = require('express');
var app = express();
var path = require('path');
+ var port = 4000;
+
+ // Displays server log in the CLI
+ app.use(express.logger());
// Set server port
- app.listen(4000);
- console.log('server is running');
+ app.listen(port);
+ console.log("Server is running at => http://localhost:" + port + "/\nCTRL + C to shutdown");
#### Install template language

0 comments on commit 54aa088

Please sign in to comment.