분류 전체보기

꺼내먹는/알쓸신잡

.prettierrc 설정값

홑따옴표 "singleQuote": true 문자열을 기본적으로 " 기호(쌍따옴표)를 사용해서 표시. ' 기호(홑따옴표)를 사용하고 싶다면 singleQuote 옵션을 true로 설정. 한 줄 최대 글자수 "printWidth": 120 기본적으로 한 줄에 글자수를 최대 80자로 제한. 한 줄에 최대 글자수를 늘리고 싶다면 사용. 세미콜론 "semi": false Prettier는 기본적으로 각 문장(statement) 뒤에 ; 기호(세미콜론)를 자동 생성. 이 세미콜론을 생략하고 싶다면 semi 옵션을 false로 설정 화살표 함수 괄호 "arrowParens": "avoid" 화살표 함수를 작성하면 Prettier는 매개변수가 하나 밖에 없더라도 매개변수 부분을 () 기호(소괄호)로 감쌈. 매개변수가..

Error Solution

npm 참조 에러

에러명 npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. 에러 설명 🔖 버전 참조를 할 때 서로 맞지 않아 나는 에러 npm 6 까지는 --legacy-peer-deps 와 비슷한 방식으로 자동 설치되었으나 npm 7부터 우선 차단 시키기 때문에 발생 해결 방법 -force: bypass the conflict 충돌 우회 npm i --force -legacy-peer-deps: ignore peer depende..

Error Solution

413 Payload too large

에러명 ERROR [ExceptionsHandler] request entity too large PayloadTooLargeError : request entity too large 에러 설명 🔖 Nestjs의 API를 PUT, POST 등으로 호출할 경우에 Json 용량이 커지게 될 경우 발생하는 에러 해결 방법 main.ts에 다음 내용 추가 (app.listen 위에 추가) import { json } from 'body-parser'; app.use(json({ limit: '50mb' })); await app.listen(port);

Error Solution

nodejs & npm 업데이트 에러

에러명 ERROR: npm is known not to run on Node.js v10.19.0 You'll need to upgrade to a newer Node.js version in order to use this version of npm. You can find the latest version at https://nodejs.org/ 에러 설명 🔖 npm과 node.js 의 버전이 안맞아서 충돌 해결 방법 캐시 삭제 (chche가 남아있는 경우 에러 발생 가능성이 있음) sudo npm cache clean -f node.js와 npm 완전 제거 sudo apt remove nodejs npm node.js와 npm 이전 파일 삭제 sudo apt remove --purge nodejs ..

Error Solution

Delete ␍ eslint (prettier/prettier)

에러명 Delete ␍ eslint (prettier/prettier) 에러 설명 🔖 windows에서 발생하는 오류 prettier의 기본 라인 개행 방식(lf)이 windows의 개행 방식(crlf)과 다르기 때문에 발생 해결 방법 eslint 설정에서 prettier의 개행 방식을 auto로 변경 1. package.json에 eslintConfig가 위치한 경우 "eslintConfig": { ... "rules": { // eslintConfig - rules에 다음과 같이 추가 "prettier/prettier": [ "error", { "endOfLine": "auto" } ] } }, 2. 별도의 .eslintrc 파일이 있는 경우 { ... "rules": { // rules에 다음과 같..

언어/Nest.js

Decorator

Decorator 클래스 위의 함수 꾸며주는 함수나 클래스랑 붙어있어야 함 = 데코레이터랑 함수 사이에 빈칸이 있으면 안됌 틀린 예 export class AppController { constructor(private readonly appService: AppService) {} @Get() getHello(): string { return this.appService.getHello(); } } 옳은 예 export class AppController { constructor(private readonly appService: AppService) {} @Get() getHello(): string { return this.appService.getHello(); } 종류 데코레이터 역할 호출시 전..

언어/Nest.js

기본 구조

Controller, Service [Single-responsibility principle] 구조 NestJS는 컨트롤러를 비지니스 로직이랑 구분 짓고 싶어한다. 컨트롤러(Controller)는 url을 가져오고 함수를 실행시키는 역할 서비스(Service)에서 비즈니스 로직을 구현&실행시킨다. 함수가 위치하는 곳. Single-responsibility principle 하나의 module, class 혹은 function이 하나의 기능을 책임지는 것 계층 구조 Controller는 api의 호출과 응답, Service는 비즈니스 로직, Repository는 DB 작업을 담당 Controller: API 요청을 받아 쿼리, 파라미터 등을 Service에게 넘겨주고, Service로 부터 받은 결과를..

언어/Vue.js

pinia 설치 및 셋팅

설치 npm i --save pinia npm i --save pinia-plugin-persistedstate 셋팅 /src/main.ts (vue 초기 파일) - 빨간 부분이 pinia import { createApp } from 'vue'; import App from './App.vue'; import router from './router'; import vuetify from './plugins/vuetify'; import { loadFonts } from './plugins/webfontloader'; import { createPinia } from 'pinia'; import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';..

MellowHoney
'분류 전체보기' 카테고리의 글 목록 (12 Page)