Skip to main content
Glama
index.js861 B
// src/middleware/trailing-slash/index.ts var trimTrailingSlash = () => { return async function trimTrailingSlash2(c, next) { await next(); if (c.res.status === 404 && (c.req.method === "GET" || c.req.method === "HEAD") && c.req.path !== "/" && c.req.path.at(-1) === "/") { const url = new URL(c.req.url); url.pathname = url.pathname.substring(0, url.pathname.length - 1); c.res = c.redirect(url.toString(), 301); } }; }; var appendTrailingSlash = () => { return async function appendTrailingSlash2(c, next) { await next(); if (c.res.status === 404 && (c.req.method === "GET" || c.req.method === "HEAD") && c.req.path.at(-1) !== "/") { const url = new URL(c.req.url); url.pathname += "/"; c.res = c.redirect(url.toString(), 301); } }; }; export { appendTrailingSlash, trimTrailingSlash };

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