Using bcrypt inside async
Example code app.post("/register", (req, res) => { User.findOne({username: req.body.username}, async(err, doc) => { if(err) throw err; if(doc) res.send('User already exist'); if(!doc){ const hashedPassword = await bcrypt.hash(req.body.password, 10); const newUser = new User({ username: req.body.username, password: hashedPassword, }); await newUser.save(); res.send('User Created') } }) }) bcrypt ..
Node.js
2020. 9. 25. 23:18
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- string class in java
- ... in Javascript
- hackerrank javascript
- 프로그래머스
- Collection Framework
- Javascript Algorithm
- equals()
- math.abs
- algorithm
- spring boot application
- javascript
- repeat()
- java
- rest parameter
- HashMap
- easy javascript algorithm
- C++
- code refactoring
- hackerrank
- compareTo()
- hackerrank javascript solution
- Object type casting
- hackerrank solution
- HackerRank Algorithm
- 프로그래머스 알고리즘
- easy algorithm
- 알고리즘
- 프로그래머스 알고리즘문제
- math.max
- substring()
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함