Skip to content

Instantly share code, notes, and snippets.

@kuc-arc-f
Created Jun 1, 2021
Embed
What would you like to do?
sapper , bcrypt sample
// sapper , bcrypt sample
const bcrypt = require('bcrypt');
//
export async function get(req, res) {
try{
const input_pass= "pas123"
let hashed_password = bcrypt.hashSync(input_pass , 10);
console.log( hashed_password )
if(bcrypt.compareSync(input_pass, hashed_password )){
console.log( "compareSync OK" )
}
res.writeHead(200, {
'Content-Type': 'application/json'
});
res.end(JSON.stringify([]));
} catch (err) {
console.error(err);
res.writeHead(500, {'Content-Type': 'application/json' });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment