Code Monkey home page Code Monkey logo

auth-workshop-node's Introduction

Project skeleton for JavaScript auth workshop

TL;DR start the project

  1. Clone this repository: git clone https://github.com/liucijus/auth-workshop-node/
  2. Change directory to auth-workshop-node/
  3. Run npm install to fetch JavaScript dependencies
  4. Start project in development mode by running npm run start-dev

Workshop prerequisites

  • Prior experience in programming is a must
  • Editor. Pick an editor which supports JavaScript syntax highlighting. The best editor is one which you work daily. If you have hard time making decision, pick Atom
  • Install Node.js
  • Install Git
  • Install add on to modify cookies on your browser. Some of the options:

Cheats

  • Working with cookies
// read cookie
const cookieParser = require('cookie');
const cookieHeaderValue = req.header('cookie') || '';
const myCookie = cookieParser.parse(cookieHeaderValue).myCookie;

// set cookie 
res.cookie('myCookie', 'my-cookie-value');

// set cookie with some options
res.cookie('another', 'another-cookie-value', { maxAge: 900000, httpOnly: true });
  • Working with form data
const body = req.body;
const username = body.username;
const password = body.password;
  • Crypto JS
const crypto = require('crypto-js');
const SECRET = 'my secret password';

const value = 15;

// make sure value is string before calculating hash
const hash = crypto.HmacSHA256(value.toString(), SECRET).toString();
  • Bcrypt
const bcrypt = require('bcryptjs');
const password = 'qw99KJtg65';
const hash = bcrypt.hashSync(password)
const isValid = bcrypt.compareSync(password, password);

auth-workshop-node's People

Contributors

liucijus avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.