-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
29 lines (18 loc) · 790 Bytes
/
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
require('dotenv').config();
const tracer = require('./tracing')
const express = require('express')
const mongoose = require('mongoose')
const bodyParser = require('body-parser')
const {port, dbURI} = require('./config/environment')
const router = require('./config/routes')
const queryHandler = require('./lib/queryHandler')
const errorHandler = require('./lib/errorHandler')
const app = express()
mongoose.connect(dbURI, { useNewUrlParser: true })
app.use(express.static(`${__dirname}/dist`)) //look for static files in the 'dist' folder, static files are files like index.html, images, fonts...
app.use(bodyParser.json())
app.use(queryHandler)
app.use('/api',router)
app.use(errorHandler)
app.listen(port, () => console.log(`Change made on port ${port}`))
module.exports = app