class
Analyzer::Fsharp::Giraffe
- Analyzer::Fsharp::Giraffe
- Analyzer
- Reference
- Object
Overview
Giraffe is a functional web framework on top of ASP.NET Core. Routes
are HttpHandler values composed via the >=> Kleisli operator and
collected with choose [...]. Common combinators surfaced here:
route "/path"— exact path matchrouteCi "/path"— case-insensitive variantroutex "regex"— regex variant (path is reported verbatim)routef "/users/%i/%s"— typed parameterssubRoute "/prefix" handlerand friends — mount nested routes
HTTP method filters (GET, POST, etc.) appearing on the same
textual line as a route are honored; lines without an explicit
method default to a fallback set.
Defined in:
analyzer/analyzers/fsharp/giraffe.crConstant Summary
-
FALLBACK_METHODS =
["GET", "POST", "PUT", "DELETE", "PATCH"] -
HTTP_METHODS =
["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"] of ::String -
METHOD_WORD_PATTERNS =
HTTP_METHODS.map do |m| {m, /\b#{m}\b/} end -
ROUTE_COMBINATOR =
/(?:route(?:Bind|Ci[fx]?|xp?|f)?|subRoute(?:Ci|f)?)\b/ -
Crystal recompiles an interpolated regex literal on every evaluation (a full PCRE2 JIT compile). Both the stop-line matcher and the per-verb window probes interpolate only fixed patterns, so precompile them once at load time.
-
ROUTE_HANDLER_STOP_RE =
/\A(?:(?:GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)\b.*\b#{ROUTE_COMBINATOR}|#{ROUTE_COMBINATOR})/ -
ROUTEF_PARAM_TYPES =
{'i' => "int", 'd' => "int64", 'b' => "bool", 'c' => "char", 's' => "string", 'f' => "float", 'O' => "guid", 'u' => "uint64"} -
Mapping of routef format specifiers to noir path-param types.