NestJS Plugin Usage Guide
This guide will walk you through the usage of the Authenticator Module and CMS Module in your NestJS application.
Authenticator Module
The Authenticator Module is a powerful tool for managing user authentication in your application. It provides a set of endpoints for user registration, login, and password reset. To use the Authenticator Module, follow these steps:
- Import the Authenticator Module in your
app.module.ts
:
import { AuthenticatorModule } from 'path/to/authenticator.module';
@Module({
imports: [AuthenticatorModule.register(configuration)],
})
export class AppModule {}
- Use the
AuthGuard
from this myhonda-sdk
in your controller. The Authenticator Module provides the following endpoints:
import { AuthGuard } from 'myhonda-sdk';
@UseGuards(AuthGuard('customer'))
@Get("/secured")
async fetchNotifications(
@Req() req,
@Query('page') page: number,
@Query('limit') limit: number) {
return getResponseFormat(200, RES.OK);
}
- Add the followings to your .env
JWT_SECRET=secret
JWT_EXPIRES_IN=2d
CORE_MICROSERVICE_CLIENT_HOST=localhost
CORE_MICROSERVICE_CLIENT_PORT=4000
CMS Module
The CMS Module is a versatile tool for managing content in your application. It provides a set of endpoints for creating, reading, updating, and deleting content. To use the CMS Module, follow these steps:
- Import the CMS Module in your application:
import { CmsModule } from 'path/to/cms.module';
@Module({
imports: [
CmsModule.register({
imports: [PrismaModule],
providers: [PrismaService]
})
],
})
export class NotificationModule {}
- Use the provided endpoints in your application. The CMS Module provides the following endpoints:
/cms
: Create new content/cms/:id
: Read, update, or delete content/cms?sortBy=field&sortOrder=asc&filters=[{"field":"field","operator":"eq","value":"value"}]
: Paginate and filter content
That's it! You're now ready to use the Authenticator Module and CMS Module in your NestJS application. Happy coding!