🐜 fix: serve front end site

This commit is contained in:
ysandler 2020-09-15 17:55:51 -05:00 committed by Joshua Shoemaker
parent 3650c76175
commit 0dd449398b

View File

@ -1,5 +1,6 @@
import * as express from 'express'
import * as mongoose from 'mongoose'
import * as path from 'path'
import { json } from 'body-parser'
import apiRouter from '../Routes/apiRoute'
@ -14,11 +15,15 @@ class Server {
createApp (): void {
this.app = express()
this.app.use(json())
this.app.use(express.static(path.join(process.cwd(), '/web/build')))
this.connectToDatabase()
}
createRoutes (): void {
this.app.use('/api', apiRouter)
this.app.use('/', (request, response, next) => {
response.sendFile(path.join(process.cwd(), './web/build/index.html'))
})
}
connectToDatabase () {