-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
47 lines (37 loc) · 1.24 KB
/
index.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
'use strict'
// Import 3rd party libraries
const express = require('express');
const bodyParser = require('body-parser');
// Import app routes/modules
const webhook = require('./routes/webhook');
const createEvent = require('./routes/create-event');
const submitEvent = require('./routes/submit-event');
const app = express();
// If in development environment, read enviroment variables from local .env file
if (app.get('env') == 'development') {
require('dotenv').config();
}
// Set app port
app.set('view engine', 'ejs');
app.set('port', (process.env.PORT || 3600));
// Import middleware for parsing requests
app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());
// Attach routes to the app
app.use('/webhook', webhook);
app.use('/create-event', createEvent);
app.use('/submit-event', submitEvent);
app.get('/', (req, res) => {
res.render('home');
//res.send(200, 'Welcome to Mitman Bot service. Contact our bot at https://www.facebook.com/Mitman-Bot-128096021205913/');
});
app.get('/privacy', (req, res) => {
res.render('privacy');
});
app.get('/terms', (req, res) => {
res.render('terms');
});
app.listen(app.get('port'), () => {
console.log('Hello Human!')
console.log('Mitman is running on port', app.get('port'));
});