Router

URLs and routes definitions are configurable in the file, as shown:

[METHOD] [URL Pattern] [Controller.Method]
GET / MyGoSite.Hello

We can route the URLs with Revel in different ways. The following are a few routing methods with examples:

  • Fixed-path routing: Fixed-path or exact-match routing of the HTTP method and the path to invoke specific methods and controllers
  • GET/About App.About
  • Use exact match/About as path and App.About as method on the App controller
  • URL: Parameters routing - segments of the path extracted with—prefix
  • GET /user/:id User.Details

A few other methods that Revel supports for routing (that we aren't covering in this section) are auto-routing, reverse-routing, static serving, and purge.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.22.135