-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
46 lines (39 loc) · 1.04 KB
/
app.js
File metadata and controls
46 lines (39 loc) · 1.04 KB
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
/**
* Module dependencies.
*/
var http = require('http'),
path = require('path'),
express = require('express'),
engines = require('consolidate'),
favicons = require('connect-favicons');
var app = express();
/**
* General configs
*/
app.set('port', process.env.PORT || 3000);
app.use(express.logger());
// Directory structure
app.set('views', path.join(__dirname, 'views'));
app.use('/static', express.static(path.join(__dirname, 'public')));
// View Config
app.set("view options", { layout: false });
app.engine('html', engines.mustache);
app.set('view engine', 'html');
/**
* Env configs
*/
if ('development' == app.get('env')) {
app.use(express.errorHandler());
}
// Icons & Routes
app.use(favicons(__dirname + '/public/img/icons'));
app.get('/', function(req, res){
res.render('index.html');
});
// Server
var server = http.createServer(app).listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
});
// Server.js
var execute = require('./server');
execute(server);