분류 전체보기 (36) 썸네일형 리스트형 emotion in next.js + typescript jsxImportSource @emotion/react 없이 사용하기 1. emotion 설치 $ yarn add @emotion/react @emotion/styled 2. tsconfig 설정 { "compilerOptions": { ... "types": ["@emotion/react/types/css-prop"] } } 3. .babelrc { "presets": [ [ "next/babel", { "preset-react": { "runtime": "automatic", "importSource": "@emotion/react" } } ] ], "plugins": ["@emotion/babel-plugin"] } 4. eslint에서 실패할 경우 ! rule을 추가해주자 .eslintrc.jso.. mac 꿀팁 🧞♂️ 😠 check using port % lsof -i :포트 😠 kill process % kill-9 PID 💡 chrome 😀 refresh command + R 😀 new tab command + T 😀 view source command + option + U 💡 shortcut 🥰 emoji command + control + space 😀 화면 최대화 command + control + F docker 꿀팁 🧞♂️ 😠 vi : command not found # apt-get update # apt-getinstall vim typescript 꿀팁 🎈 value check 🎵 check if value in enum 🎵 check if value in json object findValue in enumOrJsonValue 🎵 find in json array values.find((e) => e.no == wnatNo ); 🎵 check if object is empty Object.keys(value).length === 0 🎈 loop 🎵 for ... of with index const array1 = ['a', 'b', 'c']; for (const [i, v] of array1.entries()) { } 🎇 online editor https://www.typescriptlang.org/play typeorm repository 뿌수기 👓 IN array import { In } from 'typeorm'; repository.find({where: { id : In(idArr)}}); https://github.com/typeorm/typeorm/issues/1239#issuecomment-367207538 👓 LIKE repository.find({ where : { name : Like(`%${name}%`)} }); repository.find({ where : { name : Like(`%${escapeLikeString(htmlentities(name))}%`)} }); // 특수 문자 처리 export const htmlentities = (value: string) => value.replace(/[\u00A0-\u999.. import sql dump file in docker ✨ local pc 에서 docker container 로 sql dump file 을 옮기고, db에 import 시키자 ! (mariadb 사용) docker container로 copy docker cp local_dump_file.sql container명:/move_dir/dump_file.sql mariadb 에 import 하기 컨테이너에 들어와서, 파일이 들어왔는지 확인한뒤 import 시키자 mysql -u root -p db명 local pc dump file 만들기 mysqldump -u [계정] -p [database] > /[경로]/[dump 파일명] export to local pc local pc termin.. jwt role guard 적용기 ✨ jwt + role guard 를 적용해 보자 ! jwt 인증과 payload 에 심어진 role로 guard 를 적용하자 (예시를 위하여 jwt access token은 post 요청시 body에 id 와 role 을 전달하면 받을수 있게 함 !) install yarn add @nestjs/config @nestjs/jwt @nestjs/passport passport passport-jwt 공통 적으로 사용하는 값들 export enum Role { role1 = 'role1', role2 = 'role2', } export class AuthDto { @ApiProperty() @IsString() id: string; @ApiProperty() @IsEnum(Ro.. aws s3 endpoint 적용기 ✔ aws-sdk 라이브러리 사용 시 endpoint 변경을 적용해보자 nestjs - service layer 에서 적용했다. import * as AWS from 'aws-sdk'; export class S3Service { private readonly s3: AWS.S3; private readonly bucketName = process.env.S3_BUCKET_NAME; constructor() { this.s3 = new AWS.S3({ s3ForcePathStyle: true, endpoint: process.env.S3_BASE_URL, accessKeyId: process.env.S3_ACCESS_KEY, secretAccessKey: process.env.S3_SECRET_KEY, .. 이전 1 2 3 4 5 다음