-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
42 lines (26 loc) · 1.07 KB
/
server.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
34
35
36
37
38
39
40
41
42
// importing dependencies
const express = require('express');
const dotenv = require('dotenv').config();
const dbconnection = require('./database/connection');
//importing routes - example company routes -
//const companyRoutes = require('./routes/companyRoutes');
// PORT defined in the env file
const PORT = process.env.PORT || 3000;
// initializing express application
const app = express();
// connect to the database
dbconnection.dbconnect();
// Request payload middleware
app.use(express.json())
app.use(express.urlencoded({ extended: true }))
// Handle custom routes - add the custom routes
// app.use('/api/v1/user', require('./routes/userRoutes'))
//app.use('/api/companies',companyRoutes);
// checks if server is working
// app.get('/', (req, res, next) => {
// res.send('Hello from my Express server v2!')
// })
// app listens on the selected Port
app.listen(PORT, () => {
console.log("Server listening ")
})