Files
papi-py/README.md
stephen schuresko 444087ad86
All checks were successful
Build and Push to Private Registry101 / build (push) Successful in 9s
docs: add OpenAPI specification links to README
2025-02-18 08:33:12 -05:00

96 lines
1.8 KiB
Markdown

# Posts API
This is the Posts API project, a simple API for managing blog posts.
## Table of Contents
- [Installation](#installation)
- [Usage](#usage)
- [Endpoints](#endpoints)
- [Contributing](#contributing)
- [License](#license)
## Installation
1. Clone the repository:
```bash
git clone https://git.fairfaxmedia.net/posts-api/papi-py.git
```
2. Navigate to the project directory:
```bash
cd papi-py
```
3. Install the dependencies:
```bash
pip install -r requirements.txt
```
## Usage
To start the server, run:
```bash
python3 papi.py
```
To start with an alternative database location(postgresql)
Use the following
```bash
DATABASE_URL='postgresql+psycopg2://user:password@hostname/database_name' python3 papi.py
```
## Endpoints
### GET /posts
Retrieve a list of all posts.
### POST /posts
Create a new post.
### GET /posts/{id}
Retrieve a specific post by ID.
### PUT /posts/{id}
Update a specific post by ID.
### DELETE /posts/{id}
Delete a specific post by ID.
##Unit Tests
make coverage
This runs coverage tests and stores the html coverage report along with functions tested in htmlcov
##deploy...
Please log into the connected container registry on Makefile:4 WHERE it says REGISTRY=
using the `docker login` command
feel free to edit the VER= tag
ensure you are logged into kubernetes so that commands kubectl and helm both work
then run
```bash
make deploy
```
##integration testing instructions
to test live on papi.kube-dev.fairfaxmedia.net
run the following:
```bash
make integration -e LIVE_HOST=http://papi.kube-dev.fairfaxmedia.net
```
to integration-test on localhost on the default port run
```bash
make integration
```
###openapi spec:
[openapi.json](https://papi.kube-dev.fairfaxmedia.net/openapi.json)
[swagger-ui](https://papi.kube-dev.fairfaxmedia.net/docs)