본문 바로가기
반응형

개발/Nest3

Nest로 SSR하기 (+MVC) npm i -g @nestjs/cli nest new project 먼저 nest로 새로운 프로젝트를 만들자. 그 후, hbs라는 라이브러리를 깔아야 한다. hbs는 대충 SSR을 위한 라이브러리라 생각하자. 하다보면 알게된다. npm install --save hbs 그 후 main.ts를 다음과 같이 작성한다. import { NestFactory } from '@nestjs/core'; import { NestExpressApplication } from '@nestjs/platform-express'; import { join } from 'path'; import { AppModule } from './app.module'; async function bootstrap() { const app .. 2022. 6. 24.
Nest 컨트롤러 컨트롤러 : 요청수신 express에서 라우팅같은 역할을 한다. import { Body, Controller, Get, Param, Req } from '@nestjs/common'; import { Request } from 'express'; import { AppService } from './app.service'; @Controller('cats') export class AppController { constructor(private readonly appService: AppService) {} @Get('hello/:id/:name') //데코레이터, 함수나 클래스에 기능을 첨가하여 재사용성 극대화 getHello(@Req() req: Request, @Body() Body, @Param.. 2022. 6. 19.
nest와 친해지기 백엔드 개발자가 없는 팀에서, 서버작업을 매번 다른팀에 요청해야하는 상황이다. "그냥 내가 서버개발도 하자" 라는 생각에 회사 성장지원비로 인프런 nest 강의를 샀다. controller.ts 데코레이터 //app.contrroller.ts import { Controller, Get } from '@nestjs/common'; import { AppService } from './app.service'; @Controller() export class AppController { constructor(private readonly appService: AppService) {} @Get() //데코레이터, 함수나 클래스에 기능을 첨가하여 재사용성 극대화, 다음 줄에 바로 코드가 있어야 한다.(10번줄.. 2022. 6. 18.
반응형