howdy/router
Types
Handles the router types
pub type Route {
Get(route: String, func: fn(Context) -> Response(BitBuilder))
Post(route: String, func: fn(Context) -> Response(BitBuilder))
Put(route: String, func: fn(Context) -> Response(BitBuilder))
Patch(route: String, func: fn(Context) -> Response(BitBuilder))
Custom(
method: String,
route: String,
func: fn(Context) -> Response(BitBuilder),
)
Delete(
route: String,
func: fn(Context) -> Response(BitBuilder),
)
Static(route: String, file_path: String)
RouterMap(route: String, routes: List(Route))
RouterMapWithFilters(
route: String,
routes: List(Route),
filters: List(fn(Filter) -> Filter),
)
Spa(route: String, file_path: String)
}
Constructors
-
Get(route: String, func: fn(Context) -> Response(BitBuilder))
Sets a function response for a request with a get method
-
Post(route: String, func: fn(Context) -> Response(BitBuilder))
Sets a function response for a request with a post method
-
Put(route: String, func: fn(Context) -> Response(BitBuilder))
Sets a function response for a request with a put method
-
Patch(route: String, func: fn(Context) -> Response(BitBuilder))
Sets a functions response for a request with a patch method
-
Custom( method: String, route: String, func: fn(Context) -> Response(BitBuilder), )
Sets a function with a response for a request with a custom method type
-
Delete(route: String, func: fn(Context) -> Response(BitBuilder))
Sets a function with a response for a request with a delete method
-
Static(route: String, file_path: String)
Sets a wildcard path for the router and trys to match files found in the file_path
-
RouterMap(route: String, routes: List(Route))
Sets a route that contains a list of other routes
-
RouterMapWithFilters( route: String, routes: List(Route), filters: List(fn(Filter) -> Filter), )
Sets a route that contains a list of other routes and applys a filter to each of the contained routes
-
Spa(route: String, file_path: String)
Sets a wildcard route that will always foward to a specific file
Example
Spa("/", "./client/index.html")