Skip to content

Tie frontend and backend together by typing the REST routes - #257

Merged
smarr merged 4 commits into
masterfrom
type-safe-http-endpoints
Jul 24, 2026
Merged

Tie frontend and backend together by typing the REST routes#257
smarr merged 4 commits into
masterfrom
type-safe-http-endpoints

Conversation

@smarr

@smarr smarr commented Jul 24, 2026

Copy link
Copy Markdown
Owner

This PR introduces static type checking for REST routes.

At the server side, routes are now registered with the defineRoute() function.
The client, i.e., frontend can access them with the apiFetch() function.

Both rely on the ApiRoutes type, which allows us to connect the route to a specific response type, which we define in shared/routes.ts.
ApiRoutes is the precise type, while apiRoutes is the object available at run time, for instance to act based on the specific HTTP method.

smarr added 4 commits July 17, 2026 16:15
Signed-off-by: Stefan Marr <git@stefan-marr.de>
This covers mostly the routes needed for the frontend.

Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
@smarr smarr added the enhancement New feature or request label Jul 24, 2026
@smarr
smarr merged commit 221210f into master Jul 24, 2026
2 checks passed
@smarr
smarr deleted the type-safe-http-endpoints branch July 24, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant