Skip to main content
Glama
router.js633 B
// src/router/trie-router/router.ts import { checkOptionalParameter } from "../../utils/url.js"; import { Node } from "./node.js"; var TrieRouter = class { name = "TrieRouter"; #node; constructor() { this.#node = new Node(); } add(method, path, handler) { const results = checkOptionalParameter(path); if (results) { for (let i = 0, len = results.length; i < len; i++) { this.#node.insert(method, results[i], handler); } return; } this.#node.insert(method, path, handler); } match(method, path) { return this.#node.search(method, path); } }; export { TrieRouter };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Valerio357/bet-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server