How to fix AXIOS_INSTANCE_TOKEN at index [0] is available in the Module context

Import HttpModule from @nestjs/common in TimeModule and add it to the imports array. Remove HttpService from the providers array in TimeModule. You can directly import it in the TimeService. import { HttpModule } from ‘@nestjs/common’; … @Module({ imports: [TerminalModule, HttpModule], providers: [TimeService], … }) TimeService: import { HttpService } from ‘@nestjs/common’; If your response type … Read more

validate nested objects using class-validator in nest.js controller

Try specifying the nested type with @Type: import { Type } from ‘class-transformer’; export class CurrencyDTO { @ValidateNested({ each: true }) @Type(() => Data) data: Data[]; } For a nested type to be validated, it needs to be an instance of a class not just a plain data object. With the @Type decorator you tell … Read more

What is the right way of production deployment of nestjs application

Own server 1) Checkout your project’s repository on your server and run npm install. 2) Run npm run build which compiles your project to javascript: rimraf dist && tsc -p tsconfig.build.json 3) Start your application with: node dist/main.js Serverless zeit now See this answer. Heroku 1) Add the file Procfile to your project’s root directory: … Read more

Optional authentication in Nest.js with @nestjs/passport

You can just create your own AuthGuard for example by extending the existing one: export class OptionalJwtAuthGuard extends AuthGuard(‘jwt’) { // Override handleRequest so it never throws an error handleRequest(err, user, info, context) { return user; } } And then use this one on your controllers instead: @UseGuards(OptionalJwtAuthGuard)

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)