more bug fix, fix to run on fly.io
This commit is contained in:
parent
aded70ea0b
commit
330baa51ac
16 changed files with 529 additions and 150 deletions
23
auth-service/routes/api.js
Normal file
23
auth-service/routes/api.js
Normal 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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue