-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
32 lines (24 loc) · 988 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* This is the main JS script that runs the server.
*
* Require core modules
* Instantiate the Express server
* Require the config for Express
* Require the config for Routes
* Start the server
*/
var Express = require('express'), // This is the lightweight routing/rendering/templating framework
http = require('http'), // Obvious
fs = require('fs'), // File system module that allows for reading and writing to files
env = process.env.NODE_ENV || 'development'; // Should return 'development' on local and 'production' on live server
// Create a new instance of Express
var app = new Express();
// Configure Express settings
require('./config/express')(app);
// Configure Route settings
require('./config/routes')(app);
// Unsecured server connection
http.createServer(app).listen(app.get('port'), function () {
'use strict';
console.log("Express server listening on port " + app.get('port') + ' within a ' + env + ' environment.');
});