Git Product home page Git Product logo

meower's Introduction

Meower - Twitter for Cats

A basic twitter clone built to demonstrate the full stack πŸ₯ž (client, server, database).

With the following features:

  • Cats can send a mew πŸ˜Έβœ‰οΈ
  • Cats can see all mews that have been sent πŸ˜»πŸ—‚

example-site

Objectives

  • πŸ“ Diagram the Full Stack
  • πŸ”Ž Differentiate between Client and Server
  • ⌨️ Get user input on the Client
  • ➑️ Send user input from the client with fetch to the server
  • πŸ—ƒ Store data in a database
  • πŸ” Retrieve data from a database on the Server
  • ⬅️ Retrieve data from a server on the client using Fetch
  • πŸ™ˆ Hide/Show elements on the client
  • ✨ Add elements to the page on the client
  • πŸš€ Deploy the client with now.sh
  • πŸš€ Deploy the database with mlab
  • πŸš€ Deploy the server with now.sh

Front-end

Back-end

  • Create server folder
  • npm init -y
  • npm install express morgan
  • Setup index.js
  • Add GET / route
  • Add POST /mews route
    • log out req.body

Front-end

  • fetch POST /mews with form data
  • See the CORS error and revel in this moment
  • βœ… Send user input from the client with fetch to the server

Back-end

  • npm install cors
  • Make sure the server is recieving the data
  • Add JSON body parser middleware
  • Validate name and content
    • Must be a string
    • Cannot be empty
  • If not valid
    • Error code 422
    • Invalid mew, must contain name and content
  • Setup DB Connection
    • npm install monk
    • connect to db
    • create document collection (mews)
  • If Valid
    • Create mew object with
      • name, content, created_date
    • Insert into DB
    • Respond with created mew object
  • βœ… Store data in a database

Front-end

  • Log out created Mew after POST request
  • Show the form
  • Hide loading spinner

Back-end

  • GET /mews
    • Respond with mews from DB
  • βœ… Retrieve data from a database on the Server

Front-end

  • fetch GET /mews
    • Iterate over array
    • Append each to page
    • Reverse before appending
    • Show the form
    • Hide loading spinner
  • fetch GET /mews after creating a mew
  • βœ… Retrieve data from a server on the client using Fetch
  • βœ… Hide/Show elements on the client
  • βœ… Add elements to the page on the client

Back-end

  • npm install bad-words
    • Use filter before inserting into DB
  • npm install express-rate-limit
    • Limit to 1 request every 15 seconds

Deploy

  • βœ… Deploy server with now
    • Setup environment variables
      • Database connection
        • process.env.MONGO_URI
    • βœ… Show mlab
    • Deploy with environment variable
      • now -e MONGO_URI=@meower-db
    • Add alias
  • βœ… Deploy client folder with now
    • Set API_URL based on hostname

What's next?

  • Add comments/replies to a mew
  • User Accounts
    • Don't just have the user enter their name
    • Sign up/Login
  • User Profiles
    • Only show mews from a given user
  • Search Mews
  • Hashtags
  • User @mentions
  • Realtime feed of mews

meower's People

Contributors

w3cj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

meower's Issues

mlab.com no longer available to deploy

I setup everything as coded in the video at:
https://www.youtube.com/watch?v=JnEH9tYLxLk
upto 1:10 hours
and it is working fine on localhost. But since mlab has been acquired by mongoDB.
I can't deploy it on mlab as I am not able to register on it and it redirects me to mongoDB.
Can anyone fork the project and put the codes new programmers like me can deploy it and learn amazing things.
Thanks in advance

Cannot store the data in mongodb

I followed the youtube tutorial. I tried to install the mongo by using npm i mongo. However, I cannot console.log() from the data recieved in FETCH (API_URL ..) function in the client.js.
I think I am not setting up the db properly. Can you please help me with it?
I can only print the data entered on the form but I cannot console.log the db data which is processed in server.js

New Mews won't load after submitting one

If you visit the site and upload a meow, you will be able to old meows, but if you submit a meow, you won't be able to load older meows. It will get stuck on "Loading..."

Issue related to monk/mongo

I followed step by step as given in the video but the database does not seem to be working. To get Monk to work do we need to instal any other packages?
Also, is there a way to test if the database is working?

502 bad gateway error

Hi! I have deployed site on the internet but /mews route gives me 502 bad gateway error. I have setup a database on Atlas and followed the steps that CJ mentions in the video. Can you please help me out with 502 error?

working on it

hey cj huge fan. love the way you teach. thankyou for your valuable content. I am working on this please accept my request.

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.