-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
37 lines (24 loc) · 992 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
//define required dependencies
var express = require('express');
var app = express();
var mongoose = require('mongoose');
var bodyParser = require('body-parser');
var port = process.env.PORT || 8082;
//db connection
var database = require('./config/database');
//connect to the db
mongoose.connect(database.url);
// configure app to use bodyParser()
// this will let us get the data from a POST
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
//app.use(express.static(__dirname + '/dist')); // set the static files location
app.use(express.static( 'public')); // set the static files location
//app.use(express.static(__dirname + '/scripts')); // set the static files location
// ROUTES FOR OUR API
// =============================================================================
var router = express.Router();
require('./app/routes.js')(app);
app.listen(port);
console.log('Magic happens on port ' + port);
exports = module.exports = app;