Routing

Routing refers to determining how an application responds to a client request for a given endpoint, which is a URI (or path) and a specific HTTP request method ( GET, PUT, POST and so on onwards).

Each route can have several handlers, which are executed when the route is called.


// Function signature
app.Method(path string, ...func(*fiber.Ctx) error)
                        
  • 'app' is a Fiber instance
  • 'Method' is an HTTP request method
  • 'path' is the virtual path on the server
  • 'func(*fiber.Ctx) error' is a callback function containing the Context of the call

When using a path containing url parameters, use the c.Params function to retrieve them.

For more information about Fiber Routing, click here

routing.go