dust blog
Serve the API and Flutter App Together

Serve the API and Flutter app from one Dart server.
That is a simple full-stack setup.
The API owns the /api routes.
The Flutter app owns the browser routes, like /products/42.
dust_server can put both behind one router. API routes run first. Anything the API does not claim can fall back to the built Flutter web app.
This matters for path URLs.
If a user refreshes /products/42, the server should send index.html. Then Flutter Routing can read the URL and open the right screen.
The app logic stays split:
- server routes handle API work;
- Flutter routes handle screens;
- the generated HTTP client calls
/api; - the same server serves the built app.
This is not server-side rendering. It is one process serving an API and a client-side Flutter app.
Docs used: dust_server web apps, Dust Routing deep links, Dust HTTP clients, and Flutter URL strategies.
#Dust #DustServer #Routing #HTTPClient #Flutter
