forked from mvaragnat/pleasemeet-slack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
45 lines (33 loc) · 1.18 KB
/
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
37
38
39
40
41
42
43
44
// modules =================================================
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var http = require('http').Server(app);
var dotenv = require('dotenv');
// configuration ===========================================
//load environment variables,
//either from .env files (development),
//heroku environment in production, etc...
dotenv.load();
// public folder for images, css,...
app.use(express.static(__dirname + '/public'))
// config files
// database (always before models!)
var db = require('./config/db');
// models
//var User = require('./app/models/users');
//parsing
app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.urlencoded({ extended: true })); //for parsing url encoded
// view engine ejs
app.set('view engine', 'ejs');
// routes
require('./app/routes/routes')(app);
//port for Heroku
app.set('port', (process.env.PORT || 5000));
//START ===================================================
http.listen(app.get('port'), function(){
console.log('listening on port ' + app.get('port'));
});
//Update if needed
require('./config/monkeypatch')