Sign in

    mizchi/luna/core/routes does not have a README file

    CatchAllInfo

    pub(all) struct CatchAllInfo {
    name : String
    optional : Bool
    }

    Catch-all parameter info

    CompiledRoutes

    pub struct CompiledRoutes {
    pattern : String
    param_names : Array[String]
    component : String
    layouts : Array[String]
    kind : RoutesKind
    title : String
    meta : Array[(String, String)]
    catch_all : CatchAllInfo?
    }

    Compiled route (for matching)

    Routes

    pub(all) enum Routes {
    Page(path~ : String, component~ : String, title~ : String, meta~ : Array[(String, String)])
    Layout(segment~ : String, children~ : Array[Routes], layout~ : String)
    Get(path~ : String, handler~ : String)
    Post(path~ : String, handler~ : String)
    }

    Route definition - flat structure (supports URLPattern syntax)

    RoutesKind

    pub enum RoutesKind {
    Page
    GetApi
    PostApi
    } derive(Eq,
    Debug
    )

    Route kind

    RoutesKind::equal

    fn RoutesKind::equal(RoutesKind, RoutesKind) -> Bool

    RoutesKind::not_equal

    fn RoutesKind::not_equal(x : RoutesKind, y : RoutesKind) -> Bool

    RoutesMatch

    pub struct RoutesMatch {
    route : CompiledRoutes
    params : Array[(String, String)]
    query : Array[(String, String)]
    path : String
    }

    Match result

    RoutesMatch::component

    fn RoutesMatch::component(self : RoutesMatch) -> String

    Get component ID

    RoutesMatch::get_param

    fn RoutesMatch::get_param(self : RoutesMatch, key : String) -> String?

    Get parameter

    RoutesMatch::get_query

    fn RoutesMatch::get_query(self : RoutesMatch, key : String) -> String?

    Get query parameter

    RoutesMatch::kind

    fn RoutesMatch::kind(self : RoutesMatch) -> RoutesKind

    Get route kind

    RoutesMatch::layouts

    fn RoutesMatch::layouts(self : RoutesMatch) -> Array[String]

    Get layout ID list

    RoutesMatch::meta

    fn RoutesMatch::meta(self : RoutesMatch) -> Array[(String, String)]

    Get meta information

    RoutesMatch::title

    fn RoutesMatch::title(self : RoutesMatch) -> String

    Get title

    compile

    fn compile(routes : Array[Routes], base? : String) -> Array[CompiledRoutes]

    Compile Routes to CompiledRoutes

    match_url

    fn match_url(url : String, routes : Array[CompiledRoutes]) -> RoutesMatch?

    Match URL to routes

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io