Skip to content

Instantly share code, notes, and snippets.

@SergeyMell
Created July 30, 2020 21:28
Show Gist options
  • Save SergeyMell/94cd0bbbc5ab3f5881d893fadec9f33b to your computer and use it in GitHub Desktop.
Save SergeyMell/94cd0bbbc5ab3f5881d893fadec9f33b to your computer and use it in GitHub Desktop.
import { INestApplication } from '@nestjs/common';
import AdminBro from 'admin-bro';
import * as AdminBroExpress from 'admin-bro-expressjs';
export async function setupAdminPanel(app: INestApplication): Promise<void> {
/** Create adminBro instance */
const adminBro = new AdminBro({
resources: [], // Here we will put resources
rootPath: '/admin', // Define path for the admin panel
});
/** Create router */
const router = AdminBroExpress.buildRouter(adminBro);
/** Bind routing */
app.use(adminBro.options.rootPath, router);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment