일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- NPM
- TypeScript
- lightsail nodejs apache
- 클로저
- OOP
- this
- url #querystring
- 객체참조 #객체
- jest
- 기후변화
- git pair
- ESLint
- #cloudfront #s3 #html 확장자 없애기
- Today
- Total
목록nest.js (4)
Hello World...
특정 api 메서드는 보이지 않게 하려고 한다. 이런 경우 @ApiExcludeEndpoint() 를 사용하면 된다. import { Controller, Get } from '@nestjs/common'; import { ApiExcludeEndpoint } from '@nestjs/swagger'; import { AppService } from './app.service'; @Controller() export class AppController { constructor(private readonly appService: AppService) {} @ApiExcludeEndpoint() @Get() getHello(): string { return this.appService.getHello(); ..
api 문서가 있는 페이지에 접근 제어를 하고 싶다면 express-basic-auth 라이브러릴 활용 이름, 비밀번호로 로그인하게 할 수 있다. 로그인된 사용자만 해당 페이지 접속. import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; import { winstonLogger } from './utils/winston.util'; import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger'; import basicAuth from 'express-basic-auth'; async function bootstrap() { const app = awai..
process.env.JWT_SECRET 값을 제대로 읽지 못하는 문제가 있었다. dotenv 모듈도 설치도 하고 config 설정도 해주었지만 문제가 해결되지는 않았다. 해결 방법은 굉장히 단순했다. 백틱으로 감싸주니 문제가 해결되었다. - jwt.strategy.ts import { Injectable } from '@nestjs/common'; import { PassportStrategy } from '@nestjs/passport'; import { ExtractJwt, Strategy } from 'passport-jwt'; @Injectable() export class JwtStrategy extends PassportStrategy(Strategy) { constructor() { sup..