Skip to main content

Application configuration

import {createApplication} from "nextjs-nestapi";

export const app = createApplication({
controllers: [HelloController, PostController],
basePath: "/api", // default; routes are matched relative to this prefix
});

ApplicationOptions

OptionTypeDefaultDescription
controllersany[]The @Controller classes to register.
basePathstring"/api"Prefix routes are matched against. The catch-all route handler strips this prefix before matching, so it should match where you mount app.handle.

createApplication returns a NextJsApp — the object your catch-all route.ts calls app.handle(request) on. It also exposes app.use(middleware) for global middleware.