App type represents your Fiber application and provides methods for routing, configuration, and server lifecycle management.
Creating an App
New
Creates a new Fiber application instance.Returns a new Fiber application instance.
Example
NewWithCustomCtx
Creates a new App with a custom context factory function.Factory function that creates custom context instances.
Optional configuration for the app.
Returns a new Fiber application with custom context support.
Example
Routing Methods
HTTP Method Handlers
Register routes for specific HTTP methods.The route path pattern.
One or more handler functions.
Returns the Router instance for chaining.
Example
Use
Register middleware or mount sub-applications.Can be middleware handlers, path prefix, or sub-applications.
Returns the Router instance for chaining.
Example
Group
Create a route group with a common prefix.The prefix for all routes in the group.
Optional middleware handlers for the group.
Returns the group Router instance.
Example
Route
Define routes with a common prefix using a callback function.The prefix for all routes defined in the callback.
Callback function that receives the router.
Optional name prefix for routes.
Returns the Router instance.
Example
RouteChain
Create a chainable route for handling multiple HTTP methods.The route path.
Returns a Register interface for chaining method handlers.
Example
Route Information
Stack
Returns the raw router stack.Returns a 2D array of routes organized by HTTP method.
Example
GetRoutes
Retrieve all registered routes.When true, filters out routes registered by middleware.
Returns a slice of all routes.
Example
GetRoute
Retrieve a route by name.The route name.
Returns the named route.
Example
Name
Assign a name to the last created route.The name to assign to the route.
Returns the Router instance for chaining.
Example
HandlersCount
Returns the number of registered handlers.Returns the total handler count.
MountPath
Returns the mount path of the application.Returns the mount path or empty string if not mounted.
Example
Configuration & State
Config
Returns the app configuration.Returns a copy of the app configuration.
Handler
Returns the fasthttp request handler.Returns the handler compatible with fasthttp server.
ErrorHandler
Executes the configured error handler.The request context.
The error to handle.
Returns an error if the handler fails.
Server Lifecycle
Listen
Start the server on the specified address.The address to listen on (e.g., “:3000”).
Optional listen configuration.
Returns an error if the server fails to start.
Example
Shutdown
Gracefully shutdown the server.Returns an error if shutdown fails.
Test
Test the app with a simulated HTTP request.The HTTP request to test.
Optional test configuration (timeout, etc.).
Returns the HTTP response.
Returns an error if the test fails.
Example
Hooks
Hooks
Returns the hooks manager.Returns the hooks manager instance.
Example
Advanced
RegisterCustomBinder
Register a custom binder for request body parsing.The custom binder implementation.
RegisterCustomConstraint
Register a custom route constraint.The custom constraint implementation.
RebuildTree
Rebuild the routing tree (for dynamic route registration).Returns the app instance for chaining.
RemoveRoute
Remove a route by path.The route path to remove.
Optional HTTP methods. If omitted, removes for all methods.
GetString
Returns a string respecting the Immutable setting.The input string.
Returns the string (cloned if Immutable is enabled).
GetBytes
Returns a byte slice respecting the Immutable setting.The input byte slice.
Returns the byte slice (cloned if Immutable is enabled).