-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
33 lines (23 loc) · 769 Bytes
/
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
//An app based on
//https://www.sitepoint.com/building-facebook-chat-bot-node-heroku/
const express = require('express');
const bodyParser = require('body-parser');
require('./config/config');
var {mongoose} = require('./db/mongoose');
// Load Models
require('./models/Movie');
// Load Routes
const index = require('./routes/index');
const webhook = require('./routes/webhook');
const app = express();
// Body Parser Middleware
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json()); // parse application/json
const port = process.env.PORT || 3000;
// Use Routes
app.use('/', index);
app.use('/webhook', webhook);
app.listen(port, () => {
console.log(`Server started on port ${port}`)
});