-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from SoftwareBrothers/feat/custom-loader
Custom loader & fix for #7
- Loading branch information
Showing
14 changed files
with
2,082 additions
and
1,899 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* eslint-disable no-underscore-dangle */ | ||
import AdminBro from 'admin-bro'; | ||
import { Injectable } from '@nestjs/common'; | ||
import { AbstractHttpAdapter } from '@nestjs/core'; | ||
|
||
import { AbstractLoader } from '../../src/loaders/abstract.loader'; | ||
import { AdminModuleOptions } from '../../src/interfaces/admin-module-options.interface'; | ||
import { ExpressLoader } from '../../src/loaders/express.loader'; | ||
|
||
@Injectable() | ||
export class ExpressCustomLoader extends AbstractLoader { | ||
public register( | ||
admin: AdminBro, | ||
httpAdapter: AbstractHttpAdapter, | ||
options: AdminModuleOptions, | ||
) { | ||
// eslint-disable-next-line no-console | ||
console.log('Custom loader') | ||
new ExpressLoader().register(admin, httpAdapter, options); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
import AdminBro from 'admin-bro'; | ||
import AdminBroMongoose from '@admin-bro/mongoose'; | ||
|
||
import { NestFactory } from '@nestjs/core'; | ||
import { ValidationPipe } from '@nestjs/common'; | ||
|
||
import { AppModule } from './app.module'; | ||
|
||
AdminBro.registerAdapter(AdminBroMongoose); | ||
|
||
const bootstrap = async () => { | ||
const app = await NestFactory.create(AppModule); | ||
app.useGlobalPipes(new ValidationPipe({ | ||
transform: true, | ||
whitelist: true, | ||
})) | ||
await app.listen(3000); | ||
} | ||
bootstrap(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.