Giter Club home page Giter Club logo

exercise_6's Introduction

Exercise #6: Watch Party 2: The Single Page Experience

10 points

DUE: Friday, February 16 by 5:00pm

Instructions

For this exercise, we will build a single-page group chat web application with asynchronous Javascript and a REST API written in Python with Flask.

Like the original, Watch Party 2 lets users start group chats and invite their friends. This time, however, we serve a single static HTML page and never redirect or reload. Instead, the page interacts purely with the JSON API.

Starting with the files included in this directory, implement the UI for Watch Party in HTML, CSS, and Javascript, and serve it using server-side code written in the latest stable version of Python (3.11.2) and Flask. Routes to serve the static content are provided, so you will only need to implement the API endpoints in app.py and the javascript in script.js. You are however free to modify any other file if it makes development more convenient.

You may re-use any code from your Exercise 5. Remember to include in the README of your submission any classmates you collaborated with and any materials you consulted.

Rubric

One point each for:

  • One-click signup creates a new user in the database and returns an API key for that user. Store the API key in the user's browser, so that it is available across tabs and if the browser window is closed and reopened. A javascript logout function removes the API key from where it is stored on the user's browser and reloads the page.
  • Login API endpoint that accepts a username and password (either in the headers or request body, but not in the URL) and returns the API key for that user. All other API endpoints require a valid API key.
  • Make all HTTP requests after the page load with fetch calls to API endpoints that return JSON. Prefix API routes with /api.
  • Users can update their name and password, create and rename rooms, and post messages.
  • Visiting a screen pushes its URL to the navigation bar and the browser history. Rooms have their own unique URLs.
  • Opening /, /login, or /profile in a new browser window opens the app to those screens.
  • Opening the url for a room opens the app to that room. You may choose to encode the room id in whichever part of the URL makes the most sense to you.
  • Opening a url while logged out loads the login page, and then returns the user to that url after they log in.
  • Users can use the browser Back and Forward buttons to navigate the app.
  • While in a room, poll the API every 0.5 seconds for new messages. Stop polling after the user leaves a room.

exercise_6's People

Contributors

trevoraustin avatar felixlin99 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.