Content Menu

명이나물 라이브러리

프로필사진
  • Write
  • Manage
  • 방명록
  • 전체 (205)
    • 프로젝트 (4)
    • CS (16)
      • 운영체제(OS) (16)
      • 컴퓨터 구조 (0)
      • 네트워크 (0)
      • 자료구조 (0)
    • Ops (3)
      • AWS (1)
      • Docker (1)
      • Git (1)
    • Web (24)
      • HTML (3)
      • CSS (4)
      • JAVASCRIPT (12)
    • Language (30)
      • PYTHON (30)
      • JAVA (0)
    • Framework (21)
      • Django (3)
      • Spring (0)
      • NestJS (18)
    • DB (2)
      • Mysql (0)
      • PostgreSQL (2)
    • 코딩테스트 (103)
      • 프로그래머스 (77)
      • 백준 (22)
  • 방명록
명이나물 라이브러리명이나물 라이브러리
검색하기 폼
로그인 관리
TIL | NestJS_REST_API_Validation
글 썸네일
TIL | NestJS_REST_API_Validation

Validation movieData와 updateData의 데이터 타입에 따른 예외처리 1. movieData DTO(데이터 전송 객체 , Data Transfer Object) 생성 dto 폴더 생성 및 create-movie.dto.ts 파일생성하여 dto 타입을 지정해준다. // 클라이언트가 보낼수 있는 전송객체 export class CreateMovieDto { readonly title: string; readonly year: number; readonly genres: string[]; } 유효성 검사 1 : ValidationPipe() main.ts에 ValidationPipe추가 app.useGlobalPipes(new ValidationPipe()); import { Validat..

Framework/NestJS 2021. 10. 11. 18:44
TIL | NestJS_REST_API_Service
글 썸네일
TIL | NestJS_REST_API_Service

NestJS_REST_API_Service 우리는 Single-responsibility principle에 따라 코드를 작성할 예정이다. Single-responsibility principle란? 하나의 module, class 혹은 fuction이 하나의 기능은 꼭 책임져야한다는 뜻이다. 1. Service 생성 nest g s 2. service에서 사용할 데이터베이스를 생성한다. entity 폴더를 만들어 movie.entity.ts 파일을 생성하여 데이터의 모델을 지정해준다. export class Movie { id: number; title:string; year:number; genres: string[]; }3. movie.service.ts 작성 import { Injectable, ..

Framework/NestJS 2021. 10. 11. 15:25
TIL | NestJS_REST_API_Controller
글 썸네일
TIL | NestJS_REST_API_Controller

NestJS REST API 이번 블로그 부터는 NestJS를 사용하여 영화 관련 API를 만들어보겠습니다. 오늘은 그 시작의 첫번째, Controller입니다. 1. controller 생성 nest cli를 사용하여, controller를 생성해보겠습니다. 아래와 같이 nest cli가 지원하는 명령어가 있으며, nest generate controller 의 약자로 아래의 명령어를 실행해주고, nest g co '컨트롤러명' 을 적어줍니다. 놀라운 것은!!! movie 이름을 가진 폴더안에 컨트롤러가 자동 생성되고 동시에 module에 import가 자동으로 되었다!!! Amazing!!!!!!!! import { Module } from '@nestjs/common'; import { Movies..

Framework/NestJS 2021. 10. 11. 14:00
TIL | NestJS_REST_API_Settings
글 썸네일
TIL | NestJS_REST_API_Settings

NestJS란? 효율적이고 확장 가능한 Node.js 서버 측 애플리케이션을 구축하기위한 프레임 워크. 즉, Node.js 위에서 움직이는 프레임워크 다른 node.js프레임워크에 없는 것을 가지고 있다. node.js에서는 url, controller, templete, middle ware 등을 어느 위치에 두든 상관 없이 돌아가게 할 수 있으나, Nest.js에서는 구조와 규칙이 정해져 있다. 객체지향 프로그래밍과 함수형 프로그래밍, 심지어는 함수 반응형 프로그래밍의 요소도 일부분 사용하는 것을 알 수 있다. ** NestJS 공식 홈페이지 : https://docs.nestjs.com/ [Documentation | NestJS - A progressive Node.js framework Nest..

Framework/NestJS 2021. 10. 11. 11:32
TIL | TypeScript_기본문법2
글 썸네일
TIL | TypeScript_기본문법2

Interface 만들기 typscript interface Human { name : string; age : number; gender: string; } const person = { name : "Melody", age : 29, gender: "Female" } const sayHi = (person : Human):string => { return `hi, I'm ${person.name}, ${person.gender}, ${person.age}`; }; console.log(sayHi(person)); export {};typscript -> javastript "use strict"; Object.defineProperty(exports, "__esModule", { value: ..

Framework/NestJS 2021. 10. 10. 07:44
TIL | TypeScript_기본 문법1
글 썸네일
TIL | TypeScript_기본 문법1

index.ts 작성시 const name1 = "Melody", age1 = 29, gender1 = "Female"; const sayHi = (name, age, gender?) :void => { // void : 빈공간이라는 뜻 return 값이 없을 때 사용 console.log(`hi, I'm ${name}, ${gender}, ${age}`) }; // sayHi(name1, age1, gender1); sayHi("melody", 29, "Female"); export {}; //export를 설정하지 않으면, name이라는 변수가 다른곳에 선언되었다고 오류가 뜬다. // 오류가 뜬다.모듈인 것을 이해할 수 있도록 export 작성 // cf. return 값이 String 인 경..

Framework/NestJS 2021. 10. 10. 07:40
TIL | PostgreSQL_Setting
글 썸네일
TIL | PostgreSQL_Setting

PostgreSQL Setting 설치 $ brew install postgresql 서비스 시작 $ brew services start postgresql psql 접속 $ psql postgres $ psql postgres -U melody psql 데이터베이스 생성 postgres=# CREATE DATABASE "test_db" WITH OWNER = test ENCODING = 'UTF8' template = template0; 데이터베이스 리스트 보기 postgres=> \list 테이블 리스트 보기 postgres=> \dt 특정 database로 연결하기 postgres=> \connect test postgres=# 가 postgres=> 로 바뀐 것을 확인 할 수 있음. 특정 유저에게..

DB/PostgreSQL 2021. 10. 8. 10:55
TIL | Typescript_Setting_초기개발환경세팅
글 썸네일
TIL | Typescript_Setting_초기개발환경세팅

Typescript 왜 써야할까!?? Typescript의 장점은 먼저 type에대해 유연한 Javascript와 다르게 컴파일 단계에서 타입을 체크해주므로 Type의 오류를 실행 전단계에서 미리 점검하고 갈수있는 Type Safe Code 를 작성할수 있는 점이 있다. Typescript 의 특징 객체지향 프로그래밍 ES6클래스 Interface 지원 : 클래스와 객체를 구조화 클래스 접근제한자 지원(public, protected, private) : 은닉성, 캡슐화와 같은 OOP를 구현하는데에 도움을 줌. 따라서 2020트렌드는 TypeScript라 할 수 있겠다. VSC code에서 Typescript 사용하기 👉 TSlint 설치 TypeScrit 시작하기 nvm 버전을 8.x.x 이상으로 설정..

Framework/NestJS 2021. 10. 7. 11:52
TIL | Node_개발환경세팅
글 썸네일
TIL | Node_개발환경세팅

이번 블로그에서는 Node.js 개발환경 세팅 방법을 알아보도록 하겠습니다^ㅡ^ NVM(Node Version Manager) 설치 https://gist.github.com/falsy/8aa42ae311a9adb50e2ca7d8702c9af1 1. 터미널에 아래 명령문 입력하여 링크로 설치 $ sudo curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash 2. 설치 확인 $ nvm ls -bash: nvm: command not found 3. 에러가 난다면 vim 으로 아래 파일 생성 또는 수정하여 $ vim ~/.bash_profile 아래 코드 추가 export NVM_DIR="$HOME/.nvm" ..

Framework/NestJS 2021. 10. 5. 13:03
« 1 ··· 13 14 15 16 17 18 19 ··· 23 »

방문자

다른 주제 글 보러가기

✏️ 글쓰기

방문자

오늘
어제
전체

카테고리

«   2026/05   »
일 월 화 수 목 금 토
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

티스토리툴바