Fosi Fossil Service
Small teams. Open source. Built on Fossil.

CaaS / Lamina

Unified Management for Fossil Repositories

Public | Owner: CaaS | Default branch: trunk | Last update: 2026-10-25 00:41

Artifact 8ae496a8e4c72d974da6e18ce10eaa735e059355ec354e99463da1bdbf855a49:


-module(nova_controller).
-moduledoc "Nova Controller behaviour definition".

-export([routes/2]).

-optional_callbacks([routes/2]).

-doc "Returns the routes defined in the module, if any.".
-callback routes(Env :: atom(), Opts :: map()) -> Routes :: [map()].


-doc "Returns the routes defined in the module, if any".
-spec routes(module() | {module(), map()}, Env :: atom()) -> Routes :: [map()].
routes({Module, Opts}, Env) when is_map(Opts) ->
    routes(Module, Env, Opts);
routes(Module, Env) ->
    routes(Module, Env, #{}).

routes(Module, Env, Opts) ->
    %% try to ensure callback module is loaded first
    try Module:module_info(module)
    catch _:_ -> ok
    end,
    case erlang:function_exported(Module, routes, 2) of
        true ->
            Module:routes(Env, Opts);
        false ->
            []
    end.

Clone

You can clone this repository with the following command:

fossil clone https://fosi.dev/CaaS/Lamina

Contribute

The best way to contribute is through e-mail. See the project documentation for more details.