node

·[NodeJS] 노드
해시 함수란?: 임이의 길이를 갖는 메시지를 입력받아 고정된 길이의 해시값을 출력하는 함수일방향 함수로, 해시가 노출되어도 원래 입력 값을 알아낼 수 없다.입력 값이 같으면 항상 같은 해시를 반환한다. → 주로 웹 개발에서는, 해시 함수를 통해 비밀번호를 저장하여 보안을 높인다 !   bcrypt 모듈 사용하기모듈 설치 및 임포트npm i bcryptconst bcrypt = require(”bcrypt”);비밀번호 해시하기 - bcrypt.hashbcrypt.hash(myPlaintextPassword, salt, function(err, hash) { // Store hash in your password DB.});myPlaintextPassword : 해시하려는 값salt : 해시를 반복할 ..
·[NodeJS] 노드
express-asyns-handler란?: Express.js 경로 핸들러 내에서 비동기 작업 처리를 단순화하는 미들웨어→ 명시적인 try/catch 블록 없이도 비동기 처리 를 작성할 수 있다.   설치법npm install express-async-handler   코드예시// @desc Get all contacts// @route GET /contactsconst getAllContacts = async (req, res) => { try{ res.status(200).send("Contacts Page"); } catch (error){ res.send(error.message); }});module.exports = getAllContacts;const asyncHandler ..
마지의하루
'node' 태그의 글 목록