GithubHelp home page GithubHelp logo

firebase-realtime-database-lab's Introduction

Firebase Realtime Database

Objective:

In this lab, you will learn about reading, adding, editing and deleting info from a realtime database! As well as the structure of the database.

Before we start, make sure to go to open the folder from the previous lab, and continue to work there.

Twitter Lab:

  1. Setting up Realtime Database in Firebase:

    1. Go to your console and choose your project.
    2. Go to Realtime Database and create a database.
    3. Go to rules and change false to true.
    4. Make sure to copy the database's link.
  2. Setting up Realtime Database in app.py:

    1. In the config dictionary add databaseURL as a key and the link you copied as the value.
    2. Intialize the 'db' using the firebase object.
  3. Add in signup.html 3 inputs:

    1. full_name
    2. username
    3. bio - It should take a maximum of 280 letters.
  4. When the user signs up:

    • Create a dictionary called user that contains the inputs' name as keys and and the inputs as values.
    • Add the user to the database through the child Users adding him through his uid (retrieve it through login_session).
  5. Create a form in add_tweet.html to add a tweet to the database:

    • The form should contain:
      • Title.
      • Text- It should take a maximum of 280 letters.
      • Don't forget to add action and method
  6. When the user submits a tweet:

    • Create a dictionary called tweet that contains the inputs' name as keys and the inputs as values.
    • In the dictionary add a key named uid and the value as the uid of the user that wrote the tweet.
    • Add the tweet using the child Tweets to the database with a random key (the push method).
  7. Create an html page called tweets.html & a route called /all_tweets:

    • in this html page display all the tweets that were written:
      • Go to the child Tweets and use get().val()
Great job!
Call an Instructor/TA to check your completed tasks

If you have extra time, continue to the Bonus Problems below.
If not, make sure your code is pushed.

Bonus Problems:

  1. Add a Tweet Timestamp attribute! It should take the real time and date and save it in Tweet.

  2. Add a like button:

    • It should add 1 like to a specific tweet, everytime a like button has been clicked using the database.
Great job on completing the bonus problems section!
Make sure your code is pushed to GitHub!

firebase-realtime-database-lab's People

Contributors

fouadhadd avatar jenny-df 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.