Marketplace móvil para negocios locales mexicanos. Estructura inicial: - apps/backend (NestJS API) - apps/frontend (React Web) - apps/mobile (Expo/React Native) - apps/mcp-server (Claude MCP Server) - apps/whatsapp-service (WhatsApp Business API) - database/ (PostgreSQL DDL) - docs/ (Documentación) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
26 lines
861 B
JavaScript
26 lines
861 B
JavaScript
// 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
|
|
};
|