Git Product home page Git Product logo

backend-project's Introduction

Welcome to GitFit ๐Ÿ‘‹

  • GitFit allows you to log your workout types, check your monthly personal records, create personal workout goals, and join public workout challenges all in one beautiful site.

visitors


General

Technology and Frameworks Used:

  • Front End:

    • Bootstrap
    • jQuery
    • Axios
  • Back End:

    • Node
    • Express
    • Postgrres
    • Sequelize
    • es6-Template-Engine

Project Contributors:


Getting Started

Project tutorial:

  1. Register to the site
  2. Login
  3. Add a workout
  4. Create new public or private challenge
  5. Join already created public challenges

Description and Requirements

  • Our team was challenged with creating a fullstack project that showcases our newfound backend skills as well as our front-end knowledge.
  • Front-end Req:
    • The app needed to implement responsive web design techniques.
    • The goal of this project was mostly centered around the backend development...that being said, we still wanted our users to have a great visual experience using GitFit.
    • We were allowed to use our preference of front-end frameworks.
  • Backend Req:
    • To use Express for the HTTP framework
    • Use a view engine for our templating
    • Use PostgreSQL for our Database
      • Must have atleast three tables.
        • Where two of the tables are related (i.e. foreign keys)

Lessons Learned

  1. The power of Sequelize
  • Specifically when we had a many to many relationship for our challenges to users table.
    • Once we got the migrations and models set up properly (specifically using the belongsToMany), Sequelize has a multitude of built in methods that we were able to use to quickly accomplish the tasks necessary.
    db.User.findOne({
        where: {
            id: req.session.user.id
        }
    })
    .then(user=>{
        user.getChallenges({
        where: {
            is_completed: false,
        }
    })
        .then(challenges => {
            if(challenges.length === 0){
                res.status(404).json({error: `No ${workoutType.toLowerCase()} challenges found`})
            }else{
                res.status(200).json(challenges);
            }
        })
        .catch(e=>{
            console.log(e);
        })
    })
    .catch(e=>{
        console.log(e);
    })
  • Above demonstrates one of these powerful methods that sequelize allows us to access. Once we find the right user by referecing the session user id, we can then call the getChallenges sequelize on the user result.
    • Below is a list of other methods we could also access using the same logic from above:
      • user.getChallenges()
      • user.countChallenges()
      • user.hasChallenge()
      • user.hasChallenges()
      • user.setChallenges()
      • user.addChallenge()
      • user.addChallenges()
      • user.removeChallenge()
      • user.removeChallenges()
      • user.createChallenge()

backend-project's People

Contributors

alisonlauren avatar jc-2020 avatar plooney81 avatar

Watchers

 avatar

backend-project's Issues

Check Auth Error

If someone goes directly to a page other than home, login, or register...the website redirects them to login, after logging in we are getting errors saying cannot read property name of undefined.

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.