Made Dockerfile for FE, serve.js for express server, and docker-compose to run both FE and BE services

This commit was merged in pull request #15.
This commit is contained in:
2023-03-18 15:46:07 -04:00
parent 9b0b7b0ec7
commit cef00dac0e
3 changed files with 62 additions and 0 deletions

33
frontend/serve.js Normal file
View File

@@ -0,0 +1,33 @@
const express = require("express");
const path = require("path");
const app = express();
app.use("/*", (req, res, next) => {
now = new Date();
var datetime =
now.getFullYear() +
"/" +
(now.getMonth() + 1) +
"/" +
now.getDate() +
" " +
now.getHours() +
":" +
now.getMinutes() +
":" +
now.getSeconds();
console.log(datetime, req.method, req.baseUrl);
res.setHeader("X-Powered-By", "Ligma"); // Hide server to the client
next();
});
app.use(express.static(path.join(__dirname, "build")));
app.get("/*", function (_, res) {
res.sendFile(path.join(__dirname, "build", "index.html"));
});
app.listen(8080, () => {
console.log("Server started on port 8080");
});