-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
36 lines (29 loc) · 950 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
29
30
31
32
33
34
35
36
var express = require('express');
var mongoose = require('mongoose');
var exphbs = require('express-handlebars');
var path = require('path');
var db = mongoose.connect('mongodb://localhost/carpool');
require('./backend/api/posting/posting.model');
var app = express();
//Handlebars & other front end config
app.set('views', path.join(__dirname, 'views'));
app.engine('handlebars', exphbs({
defaultLayout: 'main',
helpers: {
ifEq: function(param1, param2, options) {
if ( param1 === param2) {
return options.fn(this);
}
}
}
}));
app.set('view engine', 'handlebars');
app.use(express.static(path.join(__dirname, 'public')));
// back end config
require('./backend/config')(app);
// include all api routes
require('./backend/routes')(app);
// include all routes for frontend
require('./routes')(app);
app.listen(3088, '0.0.0.0');
console.log('Listening on port 3088');