local ip로 node server 구동하기 (맥북)
문제점 네트워크 환경설정에 나오는 IP(IPv4 주소)로 server를 구동하면 페이지가 뜨지 않는다. 해결법 gateway 주소로 서버를 돌려야 한다. 터미널에 아래 코드를 치면 gateway 주소를 얻을 수 있다. ifconfig | grep inet app.listen(3000, "10.0.0.0"); 외부 ip에서 local...
문제점 네트워크 환경설정에 나오는 IP(IPv4 주소)로 server를 구동하면 페이지가 뜨지 않는다. 해결법 gateway 주소로 서버를 돌려야 한다. 터미널에 아래 코드를 치면 gateway 주소를 얻을 수 있다. ifconfig | grep inet app.listen(3000, "10.0.0.0"); 외부 ip에서 local...
Recoil 설치 npm install recoil App, Counter.jsx 파일 생성 App에 RecoilRoot import // App.jsx import { RecoilRoot } from "recoil"; export default function App() { return ( <RecoilRoot> ...
jsconfig.json 파일 만들고 아래와 같아 설정 { "compilerOptions": { "baseUrl": "src" }, "include": [ "src" ] }
CRA로 만든 리액트 앱은 src 경로 밖에 접근할 수 없다. 때문에 import를 통해 public 폴더에 접근하기 어렵다. src 폴더 안에 이미지 파일을 넣으면 되지만 구조적으로 마음에 들지 않는다. public 폴더 안에 img 폴더를 만들고 이미지 파일을 넣는다. import 대신 background-image나 img src=""를 ...
하면 편하지만 하기가 번거로운 그 과정.. ESLint와 Prettier 끼얹기 ESLint 설치 npm i -D eslint .eslintrc.js 파일 생성 npx eslint --init 위 명령어를 실행하면 여러 선택사항이 나온다. 프로젝트의 개발 환경에 맞춰 선택하면 된다. Prettier 설치 npm i -D prettie...
git에 저장된 repository를 module로 사용하기 npm install npm install git+https://github.com/visionmedia/express.git // 혹은 npm install git+ssh://git@github.com/visionmedia/express.git package.json에 모듈이 추...
Webpack 빌드할 때 특정 ts 파일 제외시키기 Webpack을 빌드하면서 jest test를 건너 뛰고 싶었다. tsconfig.json의 exclude 속성을 추가하면 된다. "include": ["src"], "exclude": ["**/*.test.ts", "**/*.test.tsx"] 다시 빌드하면 *.test....
mongoose 스키마의 다양한 속성 Name Description required 꼭 입력해야 한다. unique 다른 행과 중복되면 안 된다. trim 공백을 제거합니다.(문자열 타...
const exampleSchema = new mongoose.Schema({ name:{ type: String, required: true } age: Number number:Schema.Types.ObjectId created: { type: Date, default: Date.now ...
앱과 db서버의 주소나 port 등이 다른 경우 미들웨어를 통해 db서버에 접근할 수 있다. http-proxy-middleware를 설치한다. npm install http-proxy-middleware --save src 폴더에 setupProxy.js 파일을 생성한다. // setupProxy.js const { createProxy...