전체 글

Node.js

[Node.js] 절대경로 추가 - Subpath imports

Requirements Node.js ^14.6.0 or 12.19.0 별도 모듈 설치 없이, node.js의 기능만으로 절대 경로를 추가하기 위한 내용을 담고있습니다. package.json { ... "imports": { "#util/*": "./util/*", ... }, ... } 위처럼 "#alias/*" : "./경로/*" 형식으로 작성해준다. 꼭 #으로 시작해야 합니다. 더보기 jsconfig.json { "compilerOptions": { "baseUrl": ".", "paths": { "#util/*": ["util/*"] }, }, } 위처럼 jsconfig.json 도 설정해주면 좋습니다. Reference https://stackoverflow.com/questions/33214..

Node.js

[Koa] Default Response Status

Settings Node.js 18.12.1 Koa 2.13.4 Problem import Router from 'koa-router'; const router = new Router(); router.post('/', async (ctx, next) => { const result = await YourService.todo(); ctx.body = result;// [200] OK //ctx.body = '';// [200] OK //ctx.body = null;// [204] No Content }); status를 별도 지정하지 않아도, ctx.body의 값에 따라 자동으로 200이나 204로는 바꿔 주는데, [201] Created 는 찾지 못했습니다. Solution ... async func..

Node.js/React

[React] .env 환경변수

Settings CRA(Create React App) 본 포스팅에서는 CRA 사용이 전제되므로, dotenv 를 별도로 설치 및 설정하는 내용은 없습니다. 환경변수 설정 더보기 # 표준...? 자료 찾아볼 때, 이처럼 [key]=[value] 형식이 제일 많이 보여서... REACT_APP_STANDARD=im://absolute/path ## # 여백 # # whitespace is removed from both ends of unquoted values (see more on trim) # (FOO= some value becomes {FOO: 'some value'}) # 문서를 찾아보니, trim을 사용하여 앞뒤 여백을 제거한다네요. ## REACT_APP_WHITESPACE = space b..

BlockChain/Solidity

[Solidity] 문자열 비교

Settings Remix - 0.8.7+commit.e28d00a7 비교 연산자(==) 사용 불가 function compare(string memory lhs, string memory rhs) public pure returns(bool) { return lhs == rhs; } 비교 연산자 사용시, 컴파일 에러 발생 TypeError: Operator == not compatible with types string memory and string memory 비교 방법 위 내용처럼, 비교 연산자는 사용 불가하므로 다른 방안이 필요. Solidity에서는 keccak256을 사용하여 해쉬화 후 비교함. keccak256을 사용하기 위해서는 string을 bytes형으로 변환 필요. 보편적으로 아래 ..

Database/MySQL

[MySQL] mysqldump - DB 복구 오류

실행 코드 mysqldump -uroot -p [Scheme] < [File Name].sql 출력 -- MySQL dump 10.13 Distrib 5.7.37, for Linux (x86_64) -- -- Host: localhost Database: [Scheme] -- ------------------------------------------------------ -- Server version5.7.37-0ubuntu0.18.04.1 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET ..

BlockHead
BlockHead