Closed ammarhashad closed 11 months ago
Hello, Great work with this package, really appreciate your effort
when i am trying
router.get("/", (req, res) => ...)
and import router to sever
app.use("/user" ,router)
you have to send your request to "user/" and only "user" will not work
router.ts
private delegate(localPath: string, method: string, handlers: Handler[]) { // Remove trailing slash if any localPath = localPath.endsWith("/") ? localPath.slice(0, -1) : localPath
for (let i = 0; i < handlers.length; ++i) { const handler = handlers[i] if (i == handlers.length - 1) { this.submitToMap(method.toLowerCase(), localPath, handler) break }
trie-tree.ts
private dig( node: Node<k, v>, paths: string[], params: { [key: string]: any } ): Node<k, v> | null { // remove trailing slashs paths = paths.filter((path, index) => path !== "" || index < 2)
if (paths.length === 0) { return node }
and this will simulate the expressjs behavior
Noticed this as well, for now I just do this:
router.get("", async (req, res) => { // code and stuff }); app.use("/path", router);
At least until this is patched.
Should work now
Hello, Great work with this package, really appreciate your effort
when i am trying
router.get("/", (req, res) => ...)
and import router to sever
app.use("/user" ,router)
you have to send your request to "user/" and only "user" will not work
router.ts
private delegate(localPath: string, method: string, handlers: Handler[]) { // Remove trailing slash if any localPath = localPath.endsWith("/") ? localPath.slice(0, -1) : localPath
trie-tree.ts
private dig( node: Node<k, v>, paths: string[], params: { [key: string]: any } ): Node<k, v> | null { // remove trailing slashs paths = paths.filter((path, index) => path !== "" || index < 2)
and this will simulate the expressjs behavior