-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
32 lines (25 loc) · 794 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
var express = require('express');
var path = require('path');
var http = require('http');
var routes = require('./routes/index');
var app = express();
module.exports = app;
app.use(express.static(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, 'bower_components/angular')));
app.use(express.static(path.join(__dirname, 'bower_components/normalize.css')));
/**
* Routes
*/
app.use('/', routes);
app.use(function(req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});
app.use(function(err, req, res, next){
res.status(err.status || 500).redirect('/');
});
app.set('port', 3002);
http.createServer(app).listen(app.get('port'), function () {
console.log('Express server listening on port ' + app.get('port'));
});