-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
38 lines (26 loc) · 1 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
34
35
36
const express = require('express');
const cors = require('cors')
const ejs = require('ejs')
const path = require('path')
const bodyParser = require('body-parser')
const usersRouter = require('./src/routes/users')
const locationRouter = require('./src/routes/location')
const airlinesRouter = require('./src/routes/airlines')
const transactionRouter = require('./src/routes/transaction')
const flightRouter = require('./src/routes/flight')
const { PORT } = require('./src/helpers/env')
const app = express();
app.set('views', path.join(__dirname,'src/views'))
app.set('view engine', 'ejs')
app.use(bodyParser.urlencoded({ extended: false}))
app.use(bodyParser.json())
app.use(express.static('src/uploads'))
app.use(cors())
app.use('/api/v1/users', usersRouter)
app.use('/api/v1/location', locationRouter)
app.use('/api/v1/airlines', airlinesRouter)
app.use('/api/v1/flight', flightRouter)
app.use('/api/v1/transaction', transactionRouter)
app.listen(PORT, () => {
console.log(`App is running at port ${PORT}`)
});