-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
35 lines (27 loc) · 911 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
34
35
const express = require('express')
const app = express()
const bodyParser = require('body-parser')
const routerNavigation = require('./src/router')
const { static } = require('express')
const cors = require('cors')
const ejs = require('ejs')
const path = require('path')
app.set('views', path.join(__dirname,'src/views'))
app.set('view engine', 'ejs')
app.use(express.static('asset/img/'))
app.use(express.static('src/views'))
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))
const { port } = require('./src/helpers/env')
app.use(cors())
app.use(express.static(path.join(__dirname, './dist')))
app.use('*',(req,res) => {
res.sendFile(__dirname, './dist/index.html')
})
app.get('/*', (req,res) => {
res.sendFile(path.join(__dirname, './dist/index.html'))
})
app.use('/',routerNavigation)
app.listen( port , () => {
console.log(`app running on port ${port}`)
})