JsonWebToken
-
토큰 생성Study/Node, React 기초 강의_John Ahn 2023. 2. 19. 11:24
JSONWEBTOKEN 라이브러리 설치 npm install jsonwebtoken --save User.js에 토큰 생성함수 추가 // mongoose를 요청함 const mongoose = require('mongoose'); // bcrypt를 요청 const bcrypt = require('bcrypt'); // Salt를 이용해서 비밀번호를 암호화 해야하기 때문에 saltRounds를 설정 const saltRounds = 10 // jsonwebtoken 요청 const jwt = require('jsonwebtoken'); // Schema 설정 const userSchema = mongoose.Schema({ name: { type: String, maxlength: 50 }, email:..