Autostrada
Autostrada
Create a new codebase Get Autostrada Plus
Documentation Changelog Roadmap Give feedback
Login

DocumentationTraditional web application › Routing requests

Routing requests

Application routes are declared in the routes() method in the cmd/web/routes.go file. This method defines how HTTP requests – matched on method and path – are mapped to your handlers.

The exact contents of routes() will vary depending on the options you selected when generating your codebase, but it will always include at least the following pre-declared routes:

Route Handler Description
GET /static/ fileServer Serves static files from the assets/static directory.
GET / app.home Renders the home page.

If you select the User accounts and authentication option, you'll see a number of additional pre-declared routes – these are documented here.

The syntax for adding new routes depends on which router you chose when generating your codebase. Please refer to the pre-declared routes in your cmd/web/rotues.go file for examples, and the official documentation for your chosen router for full details.

  1. Documentation for http.ServeMux
  2. Documentation for Flow
  3. Documentation for Chi
  4. Documentation for Gorilla Mux
  5. Documentation for HTTPRouter