Ability to declare HTTP resources #3

Open
opened 2026-04-25 15:03:10 +02:00 by c.fahner · 0 comments
Owner

Modules should be able to declare HTTP resources. Each resource can respond differently based on the HTTP method. Supported query or body arguments are declared as function parameters and filled in using reflection.

Resources exposed by modules exist in a fixed namespace called Resources relative to the Module implementation to avoid having to keep track of all possible routes in a big centralized map. The filesystem itself basically becomes the routing table. Every incoming request is mapped to a resource based on implementation-defined (or even user-defined) routing rules. A basic implementation could simply map the URLs' path to a class name.

Links to other HTTP resources on the system can be declared in a type-safe manner by referencing the class-string<Resource>. This has the additional benefit of auto-detecting broken internal links through static analysis of the code and makes switching between front-end (HTML-generating) code and back-end code as easy as just following the class reference.

Modules should be able to declare HTTP resources. Each resource can respond differently based on the HTTP method. Supported query or body arguments are declared as function parameters and filled in using reflection. Resources exposed by modules exist in a fixed namespace called `Resources` relative to the `Module` implementation to avoid having to keep track of all possible routes in a big centralized map. The filesystem itself basically becomes the routing table. Every incoming request is mapped to a resource based on implementation-defined (or even user-defined) routing rules. A basic implementation could simply map the URLs' path to a class name. Links to other HTTP resources on the system can be declared in a type-safe manner by referencing the `class-string<Resource>`. This has the additional benefit of auto-detecting broken internal links through static analysis of the code and makes switching between front-end (HTML-generating) code and back-end code as easy as just following the class reference.
c.fahner added this to the v0.1 milestone 2026-04-25 15:03:17 +02:00
c.fahner stopped working 2026-04-25 15:03:36 +02:00
5 seconds
c.fahner deleted spent time 2026-04-25 15:03:45 +02:00
- 5 seconds
c.fahner stopped working 2026-04-25 20:20:17 +02:00
47 minutes 19 seconds
c.fahner added spent time 2026-04-26 07:40:19 +02:00
1 hour
c.fahner canceled time tracking 2026-05-02 14:23:30 +02:00
c.fahner stopped working 2026-05-02 16:29:13 +02:00
1 hour 42 minutes
c.fahner added spent time 2026-05-03 08:30:20 +02:00
45 minutes
c.fahner stopped working 2026-05-03 09:15:57 +02:00
45 minutes 32 seconds
c.fahner added spent time 2026-05-06 19:08:46 +02:00
6 hours
c.fahner canceled time tracking 2026-05-09 09:46:29 +02:00
c.fahner added spent time 2026-05-09 09:46:45 +02:00
6 hours
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Total time spent: 17 hours
c.fahner
17 hours
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
#1 Request/response flow
slendium/framework
Reference
slendium/framework#3
No description provided.