Coder Social home page Coder Social logo

pokedex-express-auth's Introduction

Pokedex Express App (with Authentication)

For this exercise, we will continue building our Pokedex web app - setting up our server to allow users to register and login with authentication.

The starter code in this repository builds upon the previous exercise's (pokedex-express).

Getting Started

  1. Fork and clone this repository to your computer
  2. Run yarn install to install dependencies
  3. Look in the starter file called index.js, run nodemon to start local server on port 3000
  4. Open localhost:3000 on your browser and see the home page

Note on comments:

The comments in this file are deliberately verbose meant to orientate you to an Express app for the first time. Feel free to remove any or all comments.

Deliverables

  • Expose a new endpoint that intercepts GET requests to /users/new, which responds with a HTML page with a new user registration form that has these fields: name and password

  • Point the form to submit data to the route (/users) using POST method

  • Using bcrypt hash the password before saving all the user data into users.json

  • Save a cookie to record that the user is currently logged in then redirect to the root '/' endpoint

  • Expose a new endpoint that intercepts GET requests to /users/logout, which clears the cookie's loggedin status and redirects to '/'

  • Expose a new endpoint that intercepts GET requests to /users/login, which responds with a HTML page with a user login form that has these fields: name and password

  • Point the form to submit data to the route (/users/login) using POST method

  • Use bcrypt to compare the password in the form with the password saved in the JSON file. Save the loggedin status in the cookie and redirect to '/' if successful

Further

  • Show 'Hi, you're logged in!' in home only if the user is logged in

  • Show 2 buttons only if the user is not logged in: one which sends the user to the register page and another which sends them to the login page

Further (refactor)

pokedex-express-auth's People

Contributors

awongh avatar raywtham avatar

Watchers

 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.