lapis icon indicating copy to clipboard operation
lapis copied to clipboard

version 1.11.0 route get/post bug?

Open AdilsonDev opened this issue 1 year ago • 2 comments

Hello @leafo

I have a problem here when moving from version 1.10.0 to 1.11.0 this route is giving a 404 error, this did not happen before in other previous versions.

Whenever I use / before the file name (/api/foo), the error occurs.

Would it be a bug?

app:get('/api/foo', '/api/foo', function(req)
  return { render = true, layout = "api.layout" }
end)

AdilsonDev avatar Jan 10 '23 00:01 AdilsonDev

I hadn't considered the use-case where a route name looks like a path with a leading /. Is there a reason why you chose this approach?

Route names are intended to be partial module paths (eg. api.foo), since there are many parts of lapis that use the route name to automatically load the corresponding module.

leafo avatar Jan 10 '23 02:01 leafo

No reason in particular, I just thought the file path would be "views" .. "/api/foo" so I put it with "/" and when updating Lapis it broke some routes on the website, but I already fixed the routes to use without the "/".

Thank you for your reply.

AdilsonDev avatar Jan 10 '23 16:01 AdilsonDev