-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
25 lines (19 loc) · 662 Bytes
/
app.js
File metadata and controls
25 lines (19 loc) · 662 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
const express = require('express');
const bodyParser = require('body-parser');
const mongoose = require('mongoose');
const app = express();
const env = process.env;
const port = 9090 || env.PORT;
const mongooseOptions = {
useNewUrlParser: true
};
mongoose
.connect('mongodb://' + env.MONGO_USERNAME + ':' + env.MONGO_PASSWORD + '@' + env.MONGO_URL, mongooseOptions)
.then(console.log('Connected to database.'))
.catch(err => console.log(err));
// Configuring the middle-ware
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.listen(port, () => {
console.log("Summit started on port " + port + ".")
});