Closed
Description
I'm not sure if this is supposed to happen, I'm just trying to set a querystring into the target url, here is an example to try
npm i restana fast-gateway
const restana = require("restana");
const gateway = require("fast-gateway");
const app = gateway({
pathRegex: "",
routes: [
{
prefix: "/some-path",
target: `http://localhost:3001/some-other-path`,
hooks: {
async onRequest(req, res) {
req.query = {
some: "thing",
};
},
},
},
],
});
restana({})
.get("/some-other-path", (req, res) => {
console.log(req.query); // < here the url has no query
res.send({});
})
.start(3001)
.then(() => console.log("ready 3001"));
app
.start(3000)
.then(() => console.log("ready 3000 || try > http://localhost:3000/some-path"));
So getting into http://localhost:3000/some-path logs an empty object, query is not being forwarded. Is there a way of doing this?
Thanks!
Metadata
Metadata
Assignees
Labels
No labels