GithubHelp home page GithubHelp logo

flask-practice-challenge-v1's Introduction

Flask Live Code Practice Challenge

Use this practice project to help sharpen your skills for the phase 4 live code!

Instructions

  • If you don't have python version 3.9.2, you may have to install with pyenv install 3.9.2. You can check with pyenv versions. You don't have to worry about setting your python version. Just that it's installed.
  • Run pipenv shell to start your virtual environment.
  • Install the dependencies with pipenv install.
  • cd into server. From there you can run the server with python app.py

Project Structure

You will have two models:

Post:

  • has a title
  • has content
  • has an author
  • has many comments

Comment:

  • has content
  • has a commenter
  • belongs to post

Challenge 1

Create a GET route that goes to /api/sorted_posts. This route should return as json all the posts alphabetized by title.

Challenge 2

Create a GET route that goes to /api/posts_by_author/<author_name>. This route should return as json the post by the author's name. For example: /api/posts_by_author/sara would return all post that belong to sara.

Challenge 3

Create a GET route that goes to /api/search_posts/<title>. This route should return as json all the posts that include the title. Capitalization shouldn't matter. So if you were to use this route like /api/search_posts/frog. It would give back all post that include frog in the title.

Challenge 4

Create a GET route that goes to /api/posts_ordered_by_comments. This route should return as json the posts ordered by how many comments the post contains in descendeding order. So the post with the most comments would show first all the way to the post with the least showing last.

Challenge 5

Create a GET route that goes to /api/most_popular_commenter. This route should return as json a dictionary like { commenter: "Bob" } of the commenter that's made the most comments. Since commenter isn't a model, think of how you can count the comments that has the same commenter name.

Note

For these challenges, you will create all of the routes in the app.py file. Look for the comment # create routes here: to know where you will place your code.

flask-practice-challenge-v1's People

Contributors

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