본문 바로가기

Javascript&Typescript32

[Node.js] 프로젝트의 Directory structure express-generator로 생성한 프로젝트의 Directory structure - package.json application dependency 와 다른 정보 정의 - bin/www application entry point application의 진짜 entry point인 app.js 를 require() 특정 port(default 3000)로 설정된 HTTP서버 설정 서버 연결, 수신 /** * Module dependencies. */ var app = require('../app'); var debug = require('debug')('btc-wallet:server'); var http = require('http'); /** * Get port from environment a.. 2022. 11. 7.
[Node.js] 프로젝트에 .gitignore 추가하기 .gitignore # Logs logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* lerna-debug.log* .pnpm-debug.log* # Diagnostic reports (https://nodejs.org/api/report.html) report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json # Runtime data pids *.pid *.seed *.pid.lock # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage *.lcov # nyc t.. 2022. 11. 4.
[Node.js] express-generator로 프로젝트 생성하기 1. express-generator 설치 express-generator : application generator tool application skeleton을 빠르게 생성. 생성된 app의 디렉토리 구조가 잡혀있어 편하게 이용 가능 npm install express-generator -g 2. 프로젝트 생성 express --view= btc-wallet 이름의 프로젝트 생성 --view=pug : pug 템플릿엔진 사용. express btc-wallet --view=pug 3. 생성한 프로젝트 폴더로 이동 & 라이브러리 설치 package.json 의 dependecies 객체 안에 있는 npm 설치 cd btc-wallet npm install 4. 서버 접속 DEBUG=btc-wallet.. 2022. 11. 4.
[Node.js] Error: error:0308010C:digital envelope routines::unsupported Error: error:0308010C:digital envelope routines::unsupported 주로 최신 버전의 node에서 생기는 이슈인 듯 하다.. 해결방법 터미널에서 아래 명령어 입력하기 export NODE_OPTIONS=--openssl-legacy-provider 참고 : https://github.com/webpack/webpack/issues/14532 2022. 10. 27.
[Node.js] Node.js 시작하기 Node 설치 2022.07.20 - [setting] - [MacOS - M1] nvm으로 node.js 와 npm 설치, 버전 업데이트 Node 설치 후 vscode에서 실행해보기 1. 사용할 프로젝트 폴더에서 src 폴더 안에 app.js 파일 생성. const http = require('http'); const hostname = '127.0.0.1'; const port = 3000; const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello World'); }); server.listen(port, hostname, (.. 2022. 10. 26.
[React] 리액트 pagination 적용 react-js-pagination 사용 https://www.npmjs.com/package/react-js-pagination npm i react-js-pagination src/components/Paging.js activePage : 현재 페이지 itemsCountPerPage : 한 페이지 당 보여줄 아이템 수 totalItemsCount : 총 아이템 수 pageRangeDisplayed : paginator에서 보여줄 페이지 범위 prevPageText : 이전 페이지로 가기를 나타내는 텍스트 nextPageText : 다음 페이지로 가기를 나타내는 텍스트 onChange : 페이지가 바뀔 때 핸들링하는 함수 import React from "react"; import Pagination.. 2022. 9. 29.