Git Product home page Git Product logo

http-authentication-practice's Introduction

http-authentication-practice

#Installation

To run this app, first go to pg.js. You will see a constant named connectionString; change pkallas to your computer's username in order to connect to your own postgres client. Afterwards, type 'npm run db-init' to create the database. Finally, type 'npm start' to launch the program, and go to localhost://3000 to begin.

#HTTP Authentication

In this benchmark goal you're going to build an Express HTTP server that allows users to signup, login and logout of your application.

Your HTTP routes will be able to render different information depending on whether the request is from an unknown visitor or a logged in user.

There are a ton of specs you need to build so make sure you break each problem down into smaller steps you can take sequentially.

#Specs

build this app in a new empty GitHub repository use node ensure all your npm dependencies are listed in your package.json use postgresql design a database schema to store users commit your schema in schema.sql use the express node package use the body-parser node package use the cookie-session node package use the pg-promise node package implement the following user stories: when you are not logged in and you visit / (the home page) you see: "Hello Stranger" a link to /signup a link to /login and you visit /signup you see: a form with: email password password confirmation "Signup" button and you submit the signup form with no values you should see the signup page again but with the error "please provide an email and a password to sign up" with a value in the password field that does not match the value in the password confirmation field you should see the signup page again but with the error "passwords do not match" with a valid email, and matching passwords a new user should be inserted into the database your session cookie should be updated with the new user id you should be logged in and redirected to the homepage and you visit /login you see: a form with: email password and you submit the login form with no values you should see the login page again with the error "please provide an email and a password to login" with a correct email but an incorrect password you should see the login page again with the error "incorrect email or password" with an incorrect email and any password you should see the login page again with the error "incorrect email or password" with a matching email and password you should be logged in and redirect to the home page and you visit /logout you are redirected to the home page when you are logged in and you visit / (the home page) you see: "Welcome back [email address]" a link to /logout and you visit /login you are redirected to the homepage and you visit /signup you are redirected to the homepage and you visit /logout you are logged out and then redirected to the home page

#Stretch

Write tests for your express routes using chai-http Encrypt passwords using bcrypt Testing

If all of the above features are correctly implemented you should be able to

signup and be logged in logout login again as that same user logout signup as a different user logout

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.