forked from yagopv/Stashy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
58 lines (42 loc) · 1.32 KB
/
server.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//*********************//
// Module dependencies //
//*********************//
var express = require('express')
, routes = require('./docs/routes')
, http = require('http')
, path = require('path');
var app = express();
//*******************************//
// Settings for all environments //
//*******************************//
//Using HTML templates
app.engine('.html', require('ejs').__express);
// Set port
app.set('port', process.env.PORT || 3000);
// Set views path and engine
app.set('views', __dirname + '/docs/views');
app.set('view engine', 'html');
// Set favicon
app.use(express.favicon(__dirname + '/docs/public/favicon.ico'));
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
// Static files configuration (js, css ...)
app.use(express.static(path.join(__dirname, 'docs/public')));
//************************************//
//Settings for development environment//
//************************************//
if ('development' == app.get('env')) {
app.use(express.errorHandler());
}
//*********//
// Routing //
//*********//
app.get('/', routes.index);
//***************//
// Create server //
//***************//
http.createServer(app).listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
});