import type { Application } from 'express'; export abstract class BaseController { /** Helper function to join paths cleanly */ protected static joinPaths(base: string, path: string): string { // Combine the base path and the specific route path let fullPath = base + path; // Remove double slashes (e.g., //user -> /user) fullPath = fullPath.replace(/\/\//g, '/'); // Ensure it starts with / (in case base was empty and path was empty) if (!fullPath.startsWith('/')) { fullPath = '/' + fullPath; } // Remove trailing slash (optional, unless it's just root '/') if (fullPath.length > 1 && fullPath.endsWith('/')) { fullPath = fullPath.slice(0, -1); } return fullPath; } static setup(app: Application) {} }