-
Aight so, here's a quick summary: Another thing - if I try printing to console in the request handler for an endpoint, nothing gets printed (again, only if the request was sent to the proxy rather than directly to the server) This is my setup for the proxy: const app = express()
const router = express.Router({})
app.use("/api", router)
router.use(express.json())
router.use(
"/auth",
createProxyMiddleware({
target: "http://localhost:8082",
changeOrigin: true
})
)
const server = http.createServer(app)
server.listen(port, () => {
console.log(`Server running on port ${port}`)
}) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The issue was this line: router.use(express.json()) Removing it fixed the issue and everything works like a charm. |
Beta Was this translation helpful? Give feedback.
The issue was this line:
Removing it fixed the issue and everything works like a charm.