module Noir::TreeSitterElysiaExtractor

Overview

Tree-sitter-backed Elysia extractor.

Elysia uses a chained-method DSL similar to Hono / Itty:

const app = new Elysia()
    .get('/users', () => ...)
    .post('/users', ({ body }) => body)
    .get('/users/:id', ({ params }) => params.id)
    .group('/api/v1', (app) =>
        app
            .get('/health', () => 'ok')
            .post('/submit', ({ body }) => body)
    )
    .listen(3000)

Recognised:

Out of scope for this first cut:

Extended Modules

Defined in:

miniparsers/elysia_extractor_ts.cr

Constant Summary

ALL_VERBS = ["GET", "POST", "PUT", "DELETE", "PATCH"]
GROUP_METHODS = Set {"group"}
HTTP_VERB_METHODS = {"get" => "GET", "post" => "POST", "put" => "PUT", "delete" => "DELETE", "patch" => "PATCH", "head" => "HEAD", "options" => "OPTIONS", "trace" => "TRACE", "connect" => "CONNECT"}
TRANSPARENT_METHODS = Set {"guard", "use"}

Instance Method Summary

Instance Method Detail

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

[View source]