Flask RESTful API example

(This repo is part of our Free Flask Tutorial)

This repo shows how to create a simple RESTful API using the Flask web framework. Among the included features, you'll see how to:

  • Return custom status codes and headers ⚡️
  • Create resources using POST requests 📬
  • Deleting resources using DELETE requests 📭
  • Test the application using Flask's test client 🔮

There's a detailed video lesson on how to perform the deploy in our Free Flask Tutorial.

Install guide

Clone the repo
$ git clone https://github.com/rmotr/flask-api-example.git
$ cd flask-api-example
Create the virtualenv
$ mkvirtualenv flask-api-example
Install dependencies
$ pip install -r requirements.txt
Run the app
$ python run_app.py

Running the app

# Step 3 requires a DB created
$ sqlite3 library.db < library-schema.sql
$ python run_app.py

Test

$ make test