Skip to content

Integrate turboapi-core: shared radix trie router + HTTP utilities #66

Description

@justrach

Context

turboAPI and merjs now share a common Zig library: turboapi-core (justrach/turboapi-core). It provides:

  • Radix trie router — method-aware, {param} + *wildcard support, fuzz-tested, O(log n) matching
  • HTTP utilitiesqueryStringGet, percentDecode, statusText, formatHttpDate
  • Bounded response cache — thread-safe BoundedCache(V) with max entry cap

The dependency is already wired in build.zig.zon and build.zig (via mer_mod.addImport("turboapi-core", core_mod)). All merjs tests pass.

What's done

  • turboapi-core library created with router, http utils, cache
  • turboAPI-python wired to import router from core (router.zig deleted from turboAPI)
  • merjs build.zig.zon + build.zig wired (path dep for now)

What's next

  • API router upgrade: Use turboapi-core.Router for api/ routes to get method-based dispatch (GET vs POST on same path)
  • Replace queryParamFromStr in request.zig with core.http.queryStringGet (identical signature, needs module import plumbing)
  • Optional: Replace linear-scan dynamic route matching with radix trie for page routes (perf win for large route counts)
  • Move to git URL dep once justrach/turboapi-core repo is published on GitHub

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions