-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
23 lines (16 loc) · 679 Bytes
/
server.js
File metadata and controls
23 lines (16 loc) · 679 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//Boiler plate routing code
let express = require('express'), app = express(), port = process.env.port || 7846
mongoose = require('mongoose'),
Games = require('./src/api/models/Game.js'), //created model loading here
bodyParser = require('body-parser');
//Set up mongoose!
mongoose.Promise = global.Promise;
mongoose.connect('mongodb://localhost/');
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
let routes = require('./src/api/routes/games.js'); //importing route
routes(app); //register the route
//Start the server
app.listen(port)
//Log the port and that the app has started
console.log("Dots and Boxes started on port " + port);