Did you know ... Search Documentation:
Pack arouter -- prolog/arouter.pl
PublicShow source

HTTP routing with path expressions.

 route(?Method, ?Route, ?Before, ?Goal) is nondet
Retrieves currently registered routes.
 .(+Blueprint, +Term, -Result) is det
This predicate offers syntactic suger when register a new route under Blueprint. e.g. blueprint1.routes(a/path, [get, post], handler)
 blueprint(+Name, +Prefix) is det
Registers a new blueprint for a set of handlers.
 route_get(+Route, :Goal) is det
Registers a new GET route handler.
 route_put(+Route, :Goal) is det
Registers a new PUT route handler.
 route_del(+Route, :Goal) is det
Registers a new DELETE route handler.
 route_post(+Route, :Goal) is det
Registers a new POST route handler.
 routes(+Route, +Methods, :Goal) is det
Registers new route handlers for all specified Methods.
 route_get_b(+Blueprint, +Route, :Goal) is det
Registers a new GET route handler.
 route_put_b(+Blueprint, +Route, :Goal) is det
Registers a new PUT route handler.
 route_del_b(+Blueprint, +Route, :Goal) is det
Registers a new DELETE route handler.
 route_post_b(+Blueprint, +Route, :Goal) is det
Registers a new POST route handler.
 routes_b(+Blueprint, +Route, +Methods, :Goal) is det
Registers new route handlers for all specified Methods.
 route_get(+Route, :Before, :Goal) is det
Registers a new GET route handler. Accepts Before goal.
 route_put(+Route, :Before, :Goal) is det
Registers a new PUT route handler. Accepts Before goal.
 route_del(+Route, :Before, :Goal) is det
Registers a new DELETE route handler. Accepts Before goal.
 route_post(+Route, :Before, :Goal) is det
Registers a new POST route handler. Accepts Before goal.
 routes(+Route, +Methods, :Before, :Goal) is det
Registers route handlers for all specified Methods. Accepts Before goal.
 route_get_b(+Blueprint, +Route, :Before, :Goal) is det
Registers a new GET route handler. Accepts Before goal.
 route_put_b(+Blueprint, +Route, :Before, :Goal) is det
Registers a new PUT route handler. Accepts Before goal.
 route_del_b(+Blueprint, +Route, :Before, :Goal) is det
Registers a new DELETE route handler. Accepts Before goal.
 route_post_b(+Blueprint, +Route, :Before, :Goal) is det
Registers a new POST route handler. Accepts Before goal.
 routes_b(+Blueprint, +Route, +Methods, :Before, :Goal) is det
Registers route handlers for all specified Methods. Accepts Before goal.
 new_route(+Method, +Route, :Before, :Goal) is det
Registers a new method-specific route handler. Does nothing when the route already exists for the method.
 new_route_b(+Blueprint, +Method, +Route, :Before, :Goal) is det
Registers a new method-specific route handler. Does nothing when the route already exists for the method.
 new_route(+Method, +Route, :Goal) is det
Registers a new method-specific route handler. Does nothing when the route already exists for the method.
 new_route_b(+Blueprint, +Method, +Route, :Goal) is det
Registers a new method-specific route handler. Does nothing when the route already exists for the method.
 route_remove(+Method, +Route) is det
Removes the given route. When either Method or Route or both are not set or are partially instantiated then all matching routes are removed. Method can be left unbound.
 route_remove_b(+Blueprint, +Method, +Route) is det
Removes the given route. When either Method or Route or both are not set or are partially instantiated then all matching routes are removed. Method can be left unbound.
 route(+Request) is semidet
Routes the request into an handler. Fails when no handler is found. Request must contain method(Method) and path(Path). Throws handler_failed(Method, Path) when handler was found but it failed during execution.
 route_with_fallbacks(+Fallbacks, +Request) is semidet
Routes the request into an handler. Fails when no handler is found. Request must contain method(Method) and path(Path). Throws handler_failed(Method, Path) when handler was found but it failed during execution. If no handlers could be found, fallbacks will be called until one succeeds or the whole predict fails.
 path_to_route(+Path, -Route) is det
Turns path atom like '/path/to/something' into a Prolog term path/to/something.