Q&A: Router prefix problem
See original GitHub issueHello! 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
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:
- Created 3 years ago
- Comments:9
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
I believe this is fixed in master now.