Skip to content

Instantly share code, notes, and snippets.

@AndrejGajdos
Last active June 24, 2018 07:37
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 AndrejGajdos/938237a6adfff19a18ed579512455f74 to your computer and use it in GitHub Desktop.
Save AndrejGajdos/938237a6adfff19a18ed579512455f74 to your computer and use it in GitHub Desktop.
Initializing Redis and adding one user into mock database. Whole file is available https://github.com/AndrejGajdos/auth-flow-spa-node-react/blob/master/script/server.js
// create mock database with one user
const db = redis.createClient();
db.on('error', (err) => {
console.log(`Redis Error ${err}`);
});
db.set('usersMockDatabase', JSON.stringify([
{
id: 1,
email: 'chouomam@chouman.com',
// "test" -- generated by bcrypt calculator
password: '$2a$04$4yQfCo8kMpH24T2iQkw9p.hPjcz10m.FcWmgkOhkXNPSpbwHZ877S',
userName: 'Chouomam',
},
]), redis.print);
module.exports = {
db,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment