PyAddressBook is a simple address book application built using FastAPI and SQLAlchemy for the backend and sqlite as the database. It provides a RESTful API for managing contacts.
- Create, read, update and delete contacts
- List all contacts
- Retrieve a contact by ID
- Validation and error handling
- Exception logging
Clone this repository and install the required packages by running
poetry install
To run the application, use the command
poetry run pyphonebookapi
The application will be available at http://localhost:8000.
Method | Endpoint | Description |
---|---|---|
GET | /addressbook/v1/contacts | Retrieve a list of all contacts |
GE | /addressbook/v1/contacts/{contact_id} | Retrieve a contact by ID |
POST | /addressbook/v1/contacts | Create a new contact |
PATCH | /addressbook/v1/contacts/{contact_id} | Update an existing contact by ID |
DELETE | /addressbook/v1/contacts/{contact_id} | Delete a contact by ID |
Tests can be run using the command
pytest
Note: this is a baisc app intended to learn/play with FastAPI and SQLAlchemy.