question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Q&A: Router prefix problem

See original GitHub issue

Hello! So I’ve been trying to use oak to tinker arround and found either a bug or I’m using it in an incorrect way. I have the following router :

const TodoRouter = new Router({
    prefix: '/api/todo'
}); 

TodoRouter.get('/' , async (ctx) => {
    console.log('api')
    ctx.response.body = "Hello world"
} )

What I expected : doing a Get request to localhost:port/api/todo would return “Hello World” What happened : Doing a Get Request to localhost:port/api/todo return nothing image

So my Question is, when using a Router without a Prefix, the ‘/’ route, work for either localhost:port and localhost:port/ so I would assume that with a prefix works the same, with that in mind is this the correct behaviour or a bug? Thanks in advance

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
kitsonkcommented, May 19, 2020

Yeah, sorry, I don’t know what I was thinking. Going back and looking at it, it doesn’t work as expected. Working on a fix now.

0reactions
kitsonkcommented, May 27, 2020

I believe this is fixed in master now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to reduce the size of the BGP routes using prefix-list filters?
Answer. The following prefix-list filter will deny only /24 networks injected into the iprouting table from BGP routing table.
Read more >
No null route is created for delegated prefix #3304 - GitHub
When a DHCPv6 WAN interface gets delegated a prefix, a null route should automatically be created for this prefix. This is best practice...
Read more >
Summary Routes and Longest Prefix Match Configuration
Master Cisco networks on your laptop - Free 300 page Cisco CCNA Lab Exercise Guide *https://www.flackbox.com/cisco-ccna-lab-guideIn this ...
Read more >
Deno nuggets: Using router prefix with Oak | The JS runtimes
Solution. Oak's router supports using prefixes & subrouters that allow to group common routes and avoid using full path name in the common...
Read more >
Need Help with ISP and BGP - Certain Prefixes We Advertise ...
BGP configuration is the same to both ISPs but when the certain prefixes route over ISP2, we see the issue. We've tried every...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found