From 0dd449398bfb6a0b924d8b865225844ee009527e Mon Sep 17 00:00:00 2001 From: ysandler Date: Tue, 15 Sep 2020 17:55:51 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9C=20fix:=20serve=20front=20end=20sit?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Server/Server.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Server/Server.ts b/src/Server/Server.ts index 7219620..33b9557 100644 --- a/src/Server/Server.ts +++ b/src/Server/Server.ts @@ -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 () {