forked from bleedingcode/nodejs-performance-optimizations
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4-external-operations.js
More file actions
33 lines (26 loc) · 756 Bytes
/
Copy path4-external-operations.js
File metadata and controls
33 lines (26 loc) · 756 Bytes
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
31
32
33
'use strict'
const Axios = require('axios')
const Mongoose = require('mongoose')
const BCrypt = require('bcrypt')
const { AsyncDebugger } = require('../lib/async-debugger')
const asyncDebugger = new AsyncDebugger()
// TEST FUNCTIONS
const testHTTP = async () => {
await Axios.get('https://agilite.io')
}
const testMongo = async () => {
await Mongoose.connect('mongodb://localhost/test')
Mongoose.disconnect()
}
const testBCrypt = () => {
const saltRounds = 10
const myPlaintextPassword = 'changemenow'
BCrypt.genSalt(saltRounds, (err, salt) => {
if (err) return false
BCrypt.hash(myPlaintextPassword, salt, (err, hash) => {
if (err) return false
})
})
}
// ASYNC TRACKER
asyncDebugger.startTracking('Test', testHTTP)