프로그래밍 공부 메모/nodejs
-
nodejs 서버 성능(벤치마크) 테스트프로그래밍 공부 메모/nodejs 2023. 11. 15. 23:51
https://www.npmjs.com/package/autocannon autocannon Fast HTTP benchmarking tool written in Node.js. Latest version: 7.12.0, last published: 3 months ago. Start using autocannon in your project by running `npm i autocannon`. There are 33 other projects in the npm registry using autocannon. www.npmjs.com
-
javascript vs commonjs 모듈 적용 차이점프로그래밍 공부 메모/nodejs 2023. 10. 19. 11:05
[ commonjs모듈 적용 기본 구조 ] [ javascript(ES 5~6) 모듈 적용 기본 구조 ] ※ javascript( ES5~6 )에서는 지원하는 모듈이 있지만 nodejs 에서 지원하지 않는 모듈를 사용해야할 때가 발생 예) fetch 함수는 javascript에서 기본 제공 하지만 nodejs에서는 "axios" 또는 "node-fetch" 로 대처 해야하는 경우 nodejs에서 모듈 사용 방법과 javascript의 모듈 사용 방법이 다르므로 아래의 방법으로 사용 1. package.json ( 프로젝트 전역에서 ) 아래 그림대로 package.json 파일에 "type" : "module"을 추가하면 해당 프로젝트 폴더에 모두 적용 2. 특정 파일에만 적용 ( .mjs 확장자 ) 아래..
-
module.export 사용 방법프로그래밍 공부 메모/nodejs 2023. 10. 7. 14:46
[ 모듈 만들어 내보내기 ] function encrypt(data){ return `${data}가 암호화 되었습니다`; } function send(url, data){ const encryptedData = encrypt(data); console.log(`${encryptedData}를 ${url}로 보냈습니다`) } module.exports = { send } [ 사용시 ] // 체인 메소드 없이 바로 사용 const { send } =require("./test"); // 체인 메소드 방식으로 사용 sendTest.send() const sendTest = require("./test"); function makeRequest(url, data){ //요청 보내기 send(url); //데이..
-