-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
33 lines (28 loc) · 1.12 KB
/
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
'use strict';
//------------------------------// Third Party Resources \\----------------------------\\
require('dotenv').config();
const mongoose = require('mongoose');
//---------------------------------// Import Resources \\-------------------------------\\
const client = require('./src/models/database');
const server = require('./src/server');
//--------------------------------// Esoteric Resources \\-------------------------------\\
const MONGODB_URI = process.env.MONGODB_URI || 'mongodb+srv://messeili:MOMO0000@cluster0.zibi1.mongodb.net/jobify?retryWrites=true&w=majority' || 'mongodb://localhost:27017/jobify';
const PORT = process.env.PORT;
//--------------------------------// Server Connection \\--------------------------------\\
mongoose
.connect(MONGODB_URI, {
useFindAndModify: false,
useNewUrlParser: true,
useUnifiedTopology: true,
})
.then(() => {
client
.connect()
.then(() => {
server.start(PORT);
})
.catch((err) => {
console.error(err.message);
});
});
//---------------------------------------------------------------------------------------\\