Add a fallback [Handler] to the router. #125

Closed
opened 2025-12-07 20:43:37 +00:00 by 0riginaln0 · 1 comment
0riginaln0 commented 2025-12-07 20:43:37 +00:00 (Migrated from github.com)

If no routes matches the incoming request, the fallback callback will be invoked.

Maybe we can somehow export axum's fallback handler into the server object.

Usage example:

local server = require("http").server:new()

server:get("/", function() return "root" end)

server:fallback(function() return 404 end)

server:run()
If no routes matches the incoming request, the fallback callback will be invoked. Maybe we can somehow export axum's [fallback](https://github.com/tokio-rs/axum/blob/main/axum/src/docs/routing/fallback.md) handler into the server object. Usage example: ```lua local server = require("http").server:new() server:get("/", function() return "root" end) server:fallback(function() return 404 end) server:run() ```
ElhamAryanpur commented 2025-12-12 08:19:17 +00:00 (Migrated from github.com)

This would be really sweet!

This would be really sweet!
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ArkForgeLabs/Astra#125
No description provided.