A Restful API for post delivery system.
-
Clone the repository:
git clone https://github.com/your-username/fastapi-project.git cd magic-post
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
uvicorn magicpost.app:app --reload
This will start the FastAPI application locally, and you can access the API documentation at http://127.0.0.1:8000/docs.
To run the tests, use the following command:
pytest
Require psql, pg_dump (included with PostgresSQL). Only tested on Linux, PostgresSQL 16.1.
-
Connect to the database as superuser
sudo -iu postgresql psql
-
Create database
sudo -iu postgresql createdb -T template0 magicpost_db
-
Restore data
sudo -iu postgresql psql magicpost_db magicpost/data/magicpost-27-12-2023.dump
-
Create user with permission
CREATE USER magicpost_user WITH PASSWORD 'magicpost_password'; GRANT ALL PRIVILEGES ON DATABASE magicpost_db TO magicpost_user;
-
Run application with database
DATABASE_URL=postgresql://magicpost_user:magicpost_password@localhost/magicpost_db uvicorn magicpost.app:app --reload
Just run the dockerfile.
The API documentation is generated dynamically and can be accessed at http://127.0.0.1:8000/docs when the application is running.
Contributions are welcome!
This project is licensed under the GPL-3.0.