more bug fix, fix to run on fly.io

This commit is contained in:
JBB0807 2025-05-20 17:03:18 -07:00
parent aded70ea0b
commit 330baa51ac
16 changed files with 529 additions and 150 deletions

View file

@ -0,0 +1,23 @@
const { createProxyMiddleware } = require("http-proxy-middleware");
const api = require("express").Router();
const ASSIGNMENT_SERVICE_URL = process.env.ASSIGNMENT_SERVICE_URL;
// rerout to asisgnment url
api.use((req, res, next) => {
console.log(`Proxying request to: ${ASSIGNMENT_SERVICE_URL} : original url : ${req.originalUrl}`);
next();
});
api.use(
'/',
createProxyMiddleware({
target: ASSIGNMENT_SERVICE_URL,
changeOrigin: true,
pathRewrite: {
'^/api': '', // only remove /api
},
})
);
module.exports = api;