forked from alexandrobin/hrbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
38 lines (27 loc) · 1002 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
37
38
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'))
//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('./routes/routes')(app);
//port for Heroku
app.set('port', (process.env.PORT));
//botkit (apres port)
require('./controllers/botkit')
//START ===================================================
http.listen(app.get('port'), function(){
console.log('listening on port ' + app.get('port'));
});