module Noir::TreeSitterKotlinKtorRouteExtractor

Overview

Tree-sitter-backed Ktor DSL route extractor.

Walks the canonical Ktor server idiom:

routing {
  get("/x") { ... }
  route("/api") {
    post("/items") { val item = call.receive < Item > () }
  }
  authenticate("auth-jwt") {
    get("/profile") { ... }
  }
}

Recognises:

Not covered yet (out of scope for this first cut):

Extended Modules

Defined in:

miniparsers/kotlin_ktor_route_extractor_ts.cr

Constant Summary

HTTP_VERB_NAMES = {"get" => "GET", "post" => "POST", "put" => "PUT", "delete" => "DELETE", "patch" => "PATCH", "head" => "HEAD", "options" => "OPTIONS"}
PASSTHROUGH_NAMES = Set {"routing", "authenticate", "rateLimit", "install", "intercept", "host", "port"}

Pass-through DSL calls — descend into their lambda body without changing the path prefix. routing is the entry point; authenticate wraps a sub-tree behind an auth realm; the remaining names cover the common Ktor scoping helpers.

Instance Method Summary

Instance Method Detail

def extract_routes(source : String, *, include_callees : Bool = false) : Array(Route) #

[View source]