-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
71 lines (54 loc) · 1.53 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
var express = require('express');
var app = express();
var volleyball = require('volleyball');
var nunjucks = require('nunjucks');
var bodyParser = require('body-parser');
var tplanRouter = require('./routes/tripPlanner');
var Place = require('./models').Place;
var Hotels = require('./models').Hotels;
var Activity = require('./models').Activity;
var Restaurant = require('./models').Restaurant;
var mapdb = require('./models').mapdb;
nunjucks.configure('views', {
noCache: true
});
app.engine('html', nunjucks.render);
app.set('view engine', 'html');
app.use(volleyball);
app.use(bodyParser.urlencoded({
extended: false
}));
app.use(bodyParser.json());
app.use(express.static('public'));
//app.use(express.static('/bootstrap','bower_components'));
app.use('/bootstrap', express.static('bower_components/bootstrap/dist'));
app.use('/jquery', express.static('bower_components/jquery/dist'));
app.use('/', tplanRouter);
// app.use('/', tplanRouter)
// app.use(function(err, req, res, next) {
// console.log(err);
// res.status(err.status || 500).send(err.message)
// })
//
// mapdb.sync()
// .then(function(){
// app.listen(3000, function() {
// console.log("Trip planner is listening on 3000!!!!")
// })
// .catch(console.err)
//
//
//
// })
//
app.use(function(err,req,res,next){
console.error(err);
res.status(500).send(err.message);
});
mapdb.sync()
.then(function() {
app.listen(3000, function() {
console.log('Listening to port 3000');
});
});
module.exports = app;