profile
viewpoint

Ask questionsQ&A: Router prefix problem

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

oakserver/oak

Answer questions kitsonk

I believe this is fixed in master now.

useful!

Related questions

No questions were found.
Github User Rank List