-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
28 lines (20 loc) · 823 Bytes
/
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
var http = require('http')
, connect = require('connect')
, config = require('./config.json')
, app = connect();
app.use('/', connect.static(__dirname + '/public'));
if(config.mode == 'development' || config.mode == 'dev'){
// dev mode
// use src folder
app.use('/js/', connect.static(__dirname + '/src/js'));
app.use('/css/', connect.static(__dirname + '/src/css'));
app.use('/img/', connect.static(__dirname + '/src/img'));
} else {
// production mode
// use build folder
app.use('/js', connect.static(__dirname + '/build/js'));
app.use('/css', connect.static(__dirname + '/build/css'));
app.use('/img', connect.static(__dirname + '/build/img'));
}
http.createServer(app).listen(config.http.port);
process.stdout.write('listening on port ' + config.http.port + '\n');