-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
38 lines (30 loc) · 822 Bytes
/
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
/**
* Dependencies
* @type {*|createApplication}
*/
const express = require('express');
const bodyParser = require('body-parser');
const request = require('request-promise');
/**
* Controllers
*/
const Route = require('./src/controllers/Route');
//Create an express server and define a parsing strategy on it.
const server = express();
server.use(function(req, res, next) {
// log each request to the console
console.log(req.method, req.url);
// continue doing what we were doing and go to the route
next();
});
server.use(bodyParser.urlencoded({
//Use deep parsing to deal with nested objects
extended: true
}));
//Specify the use of json
server.use(bodyParser.json());
/**
* Routes
*/
server.post('/', Route.route);
server.listen(3000, () => console.log('Listening on port 3000'));