-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
33 lines (25 loc) · 839 Bytes
/
app.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
const express = require('express');
const mongoose = require('mongoose');
const bodyParser = require('body-parser');
// Initiate App
const app = express();
// Connect to Database
const db = require('./config/dbkey').mongoURI
mongoose
.connect(db)
.then(() => console.log('Connected MongoDB Atlas!!'))
.catch(err => console.log(err));
// Body Parser Middleware
app.use(bodyParser.json())
// Dot Env Configutation
require('dotenv').config();
// Route Files
let authenticate = require('./routes/authenticate');
let loads = require('./routes/loads');
let messages = require('./routes/messages');
app.use('/authenticate', authenticate);
app.use('/loads', loads);
app.use('/messages', messages);
// Start Server
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => console.log(`Server Started on Port ${PORT}!!!`));