Skip to content

Latest commit

 

History

History

build-a-rest-api-frontend

Build a Front End for a REST API

This repository contains code related to the Real Python tutorial on building a front end for a REST API.

Setup

You should first create a virtual environment:

$ python -m venv venv
$ source venv/bin/activate

Install the pinned dependencies from requirements.txt:

(venv) $ python -m pip install -r requirements.txt

Then you can navigate into the folder source_code_start/ and create a new database:

(venv) $ cd source_code_start
(venv) $ python init_database.py

This will create or update the people.db database that you can use with your project.

After building the database, you can start the Flask server:

(venv) $ python app.py

When the Flask server is running, you can visit the front end on http://localhost:8000 and the API documentation on http://localhost:8000/api/ui.

Author

License

Distributed under the MIT license. See LICENSE for more information.