-
Notifications
You must be signed in to change notification settings - Fork 0
/
betsapi.js
24 lines (18 loc) · 928 Bytes
/
betsapi.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
const express = require('express');
const cors = require('cors')({ origin: true });
const app = express();
const server = require('http').createServer(app);
const path = require('path');
const mongoose = require('mongoose');
const config = require('./config/index.js');
const Betsapi = require('./controller/betsapi.js');
//mongoose.connect(config.DBCONNECT, { useNewUrlParser: true, useFindAndModify: false, useUnifiedTopology: true, useCreateIndex: true }).then(() => {
mongoose.connect(config.TESTDATADB, { useNewUrlParser: true, useFindAndModify: false, useUnifiedTopology: true, useCreateIndex: true }).then(() => {
console.log('Betsapi Database is connected');
app.use(cors);
app.options('*', cors);
Betsapi()
server.listen(config.betsapi, () => {
console.log(`Started server on => http://localhost:${config.betsapi}`);
});
}, err => { console.log('Can not connect to the betsapi database' + err) });