-
-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sub-app not working when mounted on "/" #107
Comments
Hey, sorry for the delay – on vacation right now 🏖 Mounting via This error, while not a super helpful message on its own, usually means that there's a problem with one of the functions you're trying to assign. Perhaps it's not a function at all. Can you post a snippet containing the Thanks |
Thanks for your reply! Funnily enough I’m leaving on vacation too right now, but I’ll send you some code as soon as I’m back next week.
…--
Wannes Salomé
Op 28 augustus 2019 om 21:26:58, Luke Edwards ([email protected](mailto:[email protected])) schreef:
Hey, sorry for the delay – on vacation right now 🏖
Mounting via .use('/', ...) is identical to .use(...). That's the same in Express too.
This error, while not a super helpful message on its own, usually means that there's a problem with one of the functions you're trying to assign. Perhaps it's not a function at all.
Can you post a snippet containing the use() block and the functions you're trying to add? Or a reproduction repo would be good too.
Thanks
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub(#107?email_source=notifications&email_token=AC2LK436OMBDADBF3UQOVBLQG3GQFA5CNFSM4IQD4AZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5MGVKA#issuecomment-525888168), or mute the thread(https://github.com/notifications/unsubscribe-auth/AC2LK43EAGHMMYJB7EOXHC3QG3GQFANCNFSM4IQD4AZQ).
|
Haha everyone is gearing up for the end-of-year sprint. Enjoy! |
Just checking in on this – still an issue? |
Hi! // INDEX.JS
const polka = require("polka");
const { PORT = 3000 } = process.env;
polka()
.use(require("./sub"))
.listen(PORT, err => {
console.log("Listening!");
}); // SUB.JS
const polka = require("polka");
module.exports = polka()
.get("/", (req, res) => {
res.end("r00t");
})
.get("/:name", (req, res) => {
res.end(`Hello there ${req.params.name}!`);
}); This time the error is a little different:
The error dissappears when change Hope this helps! |
I, too, am having this same problem exactly. |
This is fixed in As mentioned, the easy workaround is to |
Hi! For me using // INDEX.JS
const polka = require("polka");
const { PORT = 3000 } = process.env;
polka()
.use("/", require("./sub"))
.listen(PORT, err => {
console.log("Listening!");
}); // SUB.JS
const polka = require("polka");
module.exports = polka()
.get("/", (req, res) => {
res.end("r00t");
})
.get("/:name", (req, res) => {
res.end(`Hello there ${req.params.name}!`);
}); This will start running and log
This is the error I mentioned when I opened the issue. |
Faced with the same issue. A small snippet below: const polka = require('polka');
polka()
.use('/', polka().use('/', (req, res) => res.end('sub-app response')))
.listen(3000); |
Hey guys, sorry for the delay. I took a look at this a few times & have come to the conclusion that it's not worth fixing on the current stable branch. In order to fix it correctly, it requires breaking changes that are already part of the 1.0 work ( I will add complete testing for this (it's not fully implemented, yet) and update this issue once a new release has gone out. Thanks for you patience :) |
Available with |
I was trying to mount a sub-app on the root ("/") but it was throwing an error:
I tracked the error back to the
.use()
function of polka:I have been trying to find a temporary fix without succes. Or is there another way to go about this?
The text was updated successfully, but these errors were encountered: