rest-apis-flask-python
rest-apis-flask-python copied to clipboard
Projects and e-book for our course, REST APIs with Flask and Python
REST APIs with Flask and Python
💡 A full course to teach you how to use Flask and Python to make REST APIs using multiple Flask extensions and PostgreSQL.
Getting started
Enrol in the course by going to this link.
Then you can come back here to download the repository. This repository contains the code that we develop in each section of the course.
If you are familiar with Git, you can use Git to download it. Otherwise, you can download it as a zip file:
Next, start taking the course at the beginning! You can use the downloaded code files to support you while you go through the course.
I also strongly recommend you code while you take the course. A good strategy is:
- Watch the video intently, optionally while taking notes.
- Watch again, more quickly, while typing the code together with me.
- Once you're done with the video, play about with the code. Make changes, break things, then fix them, and try to thoroughly understand everything the code does.
If you do this for the entire course, I guarantee you will learn how to make REST APIs using Flask and Python well and quickly. You'll still be using Google and searching for stuff every day, but so does everyone else!
Section 2: A Full Python Refresher
The code is in files numbered between 1 and 11, covering concepts ranging from beginner to advanced.
- Variables
- Methods
- Lists, tuples, and sets
- If statements
- List comprehension
- Dictionaries
- Classes and objects
- Static and class methods
- Args and Kwargs
- Passing functions as arguments
- Decorators
Section 3: Your first REST API
The code in this section includes a simple Flask app and a HTML and JavaScript file which calls the Flask app endpoints.
Section 4: Flask-RESTful
The code in this section includes a Flask app which is an API that represents items. It also includes user registration and authentication.
We also introduce Flask-RESTful, which is a Flask extension that helps us develop APIs more easily.
Section 5: Working with SQL
The code in this section extends the last section by adding persistent storage of Items to a SQLite database.
Section 6: Flask-SQLAlchemy
The code in this section extends the previous section by replacing the manual integration with SQLite, with SQLAlchemy—an ORM (Object-Relational Mapping)—which allows us to easily replace SQLite with something like PostgreSQL or MySQL.
Section 7: Git for version control
In this section we introduce Git, a tool for code sharing and collaboration. In this course we'll use it to store the application code and then send it to our deployment tools, Heroku and DigitalOcean.
Section 8: Deploying Flask Apps to Heroku
Learn how to use GitHub and Heroku to deploy your Flask applications and make them available publicly to your users.
Section 9: Deploying Flask Apps to our own servers
Learn how to rent a server using DigitalOcean and run our Flask app in it. This is an alternative to Heroku. It's much cheaper, but requires a lot more work to get it set up.
Section 10: Security in your REST APIs
In this section we learn about https and how to enable it in your own server running with DigitalOcean.
Section 11: Token Refreshing and Flask-JWT-Extended
Learn about token freshness and how to implement refresh tokens using Flask-JWT-Extended.