-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.js
More file actions
29 lines (20 loc) · 741 Bytes
/
index.js
File metadata and controls
29 lines (20 loc) · 741 Bytes
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
'use strict'
var express = require('express');
var app = express();
var port = process.env.PORT || 5000;
var mongoose = require('mongoose');
var database = require('./configs/database');
// Pull information from HTML POST (express4)
var bodyParser = require('body-parser');
// Mongoose connection
mongoose.connect(database[process.env.NODE_ENV].url);
// Parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({'extended':'true'}));
// Parse application/json
app.use(bodyParser.json());
// Parse application/vnd.api+json as json
app.use(bodyParser.json({ type: 'application/vnd.api+json' }));
// Routes
require('./routes/api-ai.js')(app);
// Listen (start app with node index.js)
app.listen(port);