Giter Club home page Giter Club logo

mora-test's Introduction

Mora (A Quora Clone)

Try out Mora here!

Welcome to Mora, a Quora clone, is a popular social media website that allows users to publicly share questions, leave comments and vote on questions and answers. Go to our live site to sign up and start asking questions about your favorite movies and TV shows!

Alt Text

Prerequisites

Before you begin, please check the following Wiki documents:

*Feature List *Database Schema *API Routes *Frontend Routes

Installation

  1. Clone the repo
    git clone https://github.com/NJSim/Quora_Clone.git
  2. Install NPM packages
    npm install
  3. Create a .env file at the root directory with correct credentials
    DB_USERNAME=<<db_username>>
    DB_PASSWORD=<<db_password>>
    DB_DATABASE=<<db_database>>
    DB_HOST=localhost
    

Technologies used:

Backend:

PostgreSQL express.js JavaScript csrfProtection Sequelize Express-Sessions regex

Frontend:

Pug.js HTML Vanilla CSS AJAX Heroku (for hosting services) Material UI Icons (Font Awesome)

Features

Post a Question

Alt Text

Answer a Question

Alt Text

Like a Question or Answer

Alt Text

Add a Space (Category) to your Question

Alt Text

View Questions related to it's Space

Alt Text

Code Highlights / Challenges

When a user types in the search bar up above we make a POST request based on the information typed and append below. Uses regex to correctly find the question the user is looking for.

const searchBar = document.getElementById("searchBar");
  searchBar.addEventListener("keyup", async (e) => {
    const res = await fetch("/search-question", {
      method: "POST",
      body: JSON.stringify({
        title: e.target.value,
      }),
      headers: {
        "Content-type": "application/json",
      },
    });
    const questions = await res.json();
    const ul = document.getElementById("suggestions");
    ul.innerHTML = "";

    if (e.target.value) {
      for (let question of questions) {
        const newli = document.createElement("li");
        const newa = document.createElement("a");
        const newaText = document.createTextNode(question.title);
        newa.appendChild(newaText);
        newa.setAttribute("href", `/questions/${question.id}`);
        newli.appendChild(newa);
        ul.appendChild(newli);
      }
    }
  });

Challenges

The biggest challenge was understanding the concepts of votes in general. We initially added it as a data type in our questions and answers table- but it was much more complex and realized we needed separate tables for each question_votes and answer_votes. These tables needed to hold information on who made the upvote/like and what question it was in relation to. More on what question the upvote was related to challenged us to look at the hidden elements in our .pug file and we realized that hidden information about the question and user stored in each file was essential to tackling this problem.

Future Implementations

Comments on answers. Add topics or categories to questions. Search questions by categories. Add Friends via Friend Request. Notifications.

Mora Developers

https://www.linkedin.com/in/jingyuan-zhang-708ab763/ https://www.linkedin.com/in/nicolas-sim-156422170/ https://www.linkedin.com/in/wylin94/ https://www.linkedin.com/in/yingjia-zhuo-25a474170/

© 2021 Mora. No rights reserved.

mora-test's People

Contributors

prathamgwari 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.