Coder Social home page Coder Social logo

facguidebook's Introduction

FAC Guidebook

Known Vulnerabilities open issues help wanted issues open follow on Twitter

Weeks 6-7 of FAC-15: building a recommendation web app in node.js w/ backend postgres db

Running locally:

To run this project locally:

  1. Clone or fork this repo
  2. Go into the project repo: cd facGuidebook
  3. npm i
  4. npm start

Submitting a form:

If you'd like to use the form, you'll need to:

  1. Create a local database
  2. Create a .config.env file with your db credentials, for example:
    DB_URL = postgres://[username]:[password]@localhost:5432/[db_name]
    
  3. Build the database table by:
    • going into src/database/db_build.js
    • uncomment the line // dbBuilder();
    • run node src/database/db_build.js
    • go back into src/database/db_build.js and comment out the line // dbBuilder();

Testing:

If you'd like to test the project, you'll need to:

  1. Create a local testing database
  2. Create a .config.env file with your db credentials, for example:
    TEST_DB_URL = postgres://[test_username]:[test_password]@localhost:5432/[test_db_name]
    

Origins

The original repo for was created by @Whooolia, @charlielafosse, @tantsandras, and myself.

User journey:

  1. User can view ๐Ÿ‘€ existing posts

    • Pull and display data from db
  2. Click to add โž• own post

    • Check for cookie to see if user is logged in
  3. If not logged in ๐Ÿ”“ : Prompted to login or signup

    • (If logged in, jump to step 6)
  4. User signs up ๐Ÿ”

    • Client side validation - check that password is at least 8 chars, with at least 1 numb, 1 uppercase and 1 lowercase
    • Server side - Check if user name already exists in the db
    • If no error, submit form to new row in USERS table with a HASHED password
  5. User logs in ๐Ÿ”‘

    • Server side - check that username is present in db, then check that the hash of the input matches that user's hashed password.
    • If success, creates a JWT with info about specific user
  6. User can now access the post form (protected route) ๐Ÿ“ƒ

  7. User submits post form ๐Ÿ“ƒ

    • Client side - check that fields are not empty
    • Server side - check if the restaurant already exists/that a post hasn't already been made referencing it
    • If success, submit form to POSTS table and RESTAURANTS table
  8. User can view ๐Ÿ‘€ updated home page!

What we worked on ๐Ÿ•œ :

Day 1๏ธโƒฃ :

  • Creating a new database on Heroku and linking it to the new repo (this took longer than expected, we're still not sure why!)
  • Signup form validation on the client side (unmatching passwords, patterns)
  • We spent a long time tracking our callback functions through different files to figure out where to put the login form validation (to compare the password in the database with the password that is submitted)
  • whiteboard coding

Our process

img_5081 img_5082 img_5083 img_5084

Day 2๏ธโƒฃ :

  • Updated our user journey

img_5101

  • Client-side validation for the sign up page
  • Handling the USER LOGIN logic
  • Signup form validation
  • Client side - check that password is at least 8 chars, with at least 1 numb, 1 uppercase and 1 lowercase.
  • Server side - Check is user name already exists in the db

Login form validation:

  • Server side - check that username is present in db, then check that the hash of the input matches that user's hashed password!

  • Post form validation (everything we had in there last week...)

Test for server side and database SEPERATELY!

Day 3๏ธโƒฃ :

Based on rasied issues, we ..

  • Add logout button & home button
  • Add the required rules for the password validation
  • Handle the length of the resturant review
  • Travis CI - All passing! ๐Ÿ’š

Contributing

This project is absolutely open to contributers! Please browse through the open issues, or suggest your own.
First timers are ofcourse welcome. Check out the open good first issues

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.