Begin with the working server from Quickstart. The in-memory messages in this tutorial are discarded whenever the process stops.
Define application state
Inbin/server.dart, add a list after resolving the router:
List messages
Register a collection route:Read a typed route parameter
Archery validates and coerces{id:int} before the handler runs. Retrieve the typed value through RouteParams:
Parse and validate input
request.form() supports JSON, URL-encoded, and multipart request bodies. Add a route that accepts a message value:
Verify invalid input
422 and a JSON error. This validation is intentionally local to the tutorial; reusable request validation belongs in a dedicated form-request layer.
What you used
Router.get()andRouter.post()to register HTTP methods{id:int}andRouteParams.get<int>()for typed path datarequest.form()for cached request parsingrequest.json()for consistent JSON responsesHttpStatusvalues to communicate creation, validation failure, and missing records
Routing
Learn route groups, matching priority, and middleware.
Requests
Work with forms, JSON, files, and response helpers.