Docker build. Catch client routes on server. Initial config utility

This commit is contained in:
unknown 2021-06-07 13:40:51 +02:00
parent d2e6ebae4f
commit 1636b705de
10 changed files with 125 additions and 13 deletions

7
api.js
View file

@ -1,10 +1,13 @@
const path = require('path');
const express = require('express');
const errorHandler = require('./middleware/errorHandler');
const api = express();
api.get('/', (req, res) => {
res.send('Server is working');
// Static files
api.use(express.static(path.join(__dirname, 'public')));
api.get(/^\/(?!api)/, (req, res) => {
res.sendFile(path.join(__dirname, 'public/index.html'));
})
// Body parser