-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
44 lines (28 loc) · 957 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const cors = require('cors')
const express = require('express')
require('dotenv').config()
const { usersRoutes } = require('./routes')
const { experiencesRoutes } = require('./routes')
const { placesRoutes } = require('./routes')
const { bookingsRoutes } = require('./routes')
const { reviewsRoutes } = require('./routes')
const { datesRoutes } = require('./routes')
const fileUpload = require('express-fileupload')
process.env.TZ = "Europa/Amsterdam"
const app = express()
app.use(express.json())
app.use(express.static('public'))
app.use(fileUpload())
app.use(cors())
// CONSTANTES
const { BASE_URL, PORT} = process.env
// ROUTES
app.use('/users', usersRoutes)
app.use('/experiences', experiencesRoutes)
app.use('/places', placesRoutes)
app.use('/bookings', bookingsRoutes)
app.use('/reviews', reviewsRoutes)
app.use('/dates', datesRoutes)
app.listen(PORT, () => {
console.log(`Server is running on ${BASE_URL}:${PORT}`)
})