In the REST API below, what is the type of file object that is received.   @Post('/:folderId/documents/:fileName') @UseInterceptors(FileInterceptor('file')) @ApiConsumes('multipart/form-data') @ApiImplicitParam({ name: 'fo...
While using NestJS to create API's I was wondering which is the best way to handle errors/exception. I have found two different approaches :   Have individual services and validation pipes throw new Error(), have the controller catch them and tha...
I'm trying to enable usage of socket.io acknowledgement callbacks in Nest.js WebSocketGateways.  I'd like to be able to emit this:  socket.emit('event', 'some data', function (response) { //do something });   And use the messa...
The documentation is kinda thin here so I ran into a problem. I try to use Guards to secure Controller or it's Actions, so I gonna ask for the role of authenticated requests (by JWT). In my auth.guard.ts I ask for "request.user" but it...
I want to log the incoming requests and outgoing responses in NestJs. I took information from here Logging request/response in Nest.js and from the docs NestJs Aspect Interception.  It would be awesome to achieve this by not using external packages,...
I'm trying to create a user token based on the secret of the user trying to log in. However instead of using a secret from the environment I want to use a secret assigned to a user object inside the database.  import { Injectable } from '@nes...
Currently I'm using the NestJs default logging and come up with something like this  @Controller('users') export class UsersController {   private logger: Logger = new Logger(UsersController.name, true);    @Get()   public getAllUsers():...
How? How I can bundle NestJS project including node_module for offline application?  webpack.config.js  const path = require('path');  module.exports = {   entry: path.join(__dirname, 'dist/main.js'),   target: 'node',   outpu...
api.controller.ts  @Controller('api') export class ApiController {   constructor() {}    @Post()   @Transaction()   async root(@Req() req: Request, @Res() res: Response, @TransactionManager() manager: EntityManager): Promise<void> {...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.