roundabout
Types
Values
pub fn fixed(value: String) -> Segment
A path segment that is constant
e.g.
[fixed("users"), str("user_id")]
pub fn int(name: String) -> Segment
A path segment that should resolve to an integer
e.g.
[fixed("users"), int("user_id")]
pub fn main(
definitions: List(Route),
output_path: String,
) -> Result(Nil, String)
Generate the routes file
roundabout.main(route_definitions, "src/my_app/generated/routes")
pub fn route(
name name: String,
path path: List(Segment),
children children: List(Route),
) -> Route
Make a route defintion
e.g.
route("users", [fixed("users"), int("user_id")], [])
name is the name for this route, this will be used for generating the variant names and helper names.
path defines the url segments e.g. /users/1.
children generates sub types for nested routes, this is useful for middleware.