Skip to content

Instantly share code, notes, and snippets.

@kuc-arc-f
Created June 1, 2021 00:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuc-arc-f/554ca229da7d228f4d8f41c08bb72fb3 to your computer and use it in GitHub Desktop.
Save kuc-arc-f/554ca229da7d228f4d8f41c08bb72fb3 to your computer and use it in GitHub Desktop.
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