INNER CODE UNIT · TypeScript

initializeControllers

bcms/cms · backend/src/_server/main.ts:108

    async function initializeControllers(
        controllers: Controller[],
    ): Promise<void> {
        for (let i = 0; i < controllers.length; i++) {
            const controller = controllers[i];
            if (controller) {
                const data = await controller({
                    config: config as ServerConfig,
                    fastify,
                });
                logger.info('controller', `${data.name}`);
                let methods = data.methods(data);
                if (methods instanceof Promise) {
                    methods = await methods;
                }
                for (let j = 0; j < methods.length; j++) {
                    const method = methods[j];
                    const path = (data.path + method.path).replace(

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…