| HTTP Method | Use | Endpoint |
|---|---|---|
| GET | Index all books | /books |
| GET | Show book by id | /books/{id} |
| GET | Index books by title or author | /books?search=foo |
| GET | Index books with custom limit | /books?limit=5 |
| GET | Paginate books | /books?limit=5&page=3 |
| POST | Create new book | /books |
| PUT | Update book | /books/{id} |
| DELETE | Destroy book | /books/{id} |
- .NET 5.0
- PostgreSQL
-
Copy and set up enviroment variables for the database
cp .env.example .env
-
Run the app on your local port
dotnet watch run --project ./src/BookApi.csproj
-
Run the tests
cd testsdotnet test
- Docker
-
Copy environment variables for the database
cp .env.example .env
-
Build docker images
docker compose build
-
Run docker containers
docker compose up
-
Run the tests in the api container
docker compose exec api /bin/sh -c "cd tests; dotnet test;"