Skip to content

The API is designed to manage book reservations, providing an endpoint for all CRUD operations and additional endpoints to manage reservations and reservation history. The API is built with .NET 8 (the fastest and greatest ASP.NET core yet)

License

Notifications You must be signed in to change notification settings

v-limo/reservations

Repository files navigation

Reservation API

The API is designed to manage book reservations, providing an endpoint for all CRUD operations and additional endpoints to manage reservations and reservation history. The API is built with .NET 8 (the fastest and greatest ASP.NET core yet), Entity Framework and SQlite with Unit test with Xunit. Some of the keywords and terms associated with this design are swagger UI, Moq, SQlite, Fluent Validation, Unit, Xunit, Docker, docker-compose, RESTful API, Testing, API documentation, Container orchestration with kubernetes etc.

Features

The API is documented with Swagger UI. It has the following endpoints

  • GET api/v1/books - Get all books

  • GET api/v1/books/{bookId} - Get a book by id

  • POST api/v1/books - Create a book

  • PUT api/v1/books/{bookId} - Update a book

  • DELETE api/v1/books/{bookId} - Delete a book

  • POST api/v1/books/{bookId}reserve/{comment} - Reserve a book

  • POST api/v1/books/{bookId}/remove-reservation - Remove a reservation

  • GET api/v1/books/available-books - Get all available books

  • GET api/v1/books/{bookId}/history - Get reservation history for a book

[## Prerequisites

Getting Started - Running the project

1. Locally with Docker - Recommended

with Dockers
docker run -p 5099:5099 --name webapi  limov/reservationsapi:latest

# Access the API at: http://localhost:5099/swagger/index.html

2. Locally with Kubernetes — Recommended

with Kubernetes
# Clone the repository
git clone git@github.com:v-limo/reservations.git

# Navigate to project folder
cd reservations

# Apply kubernetes configuration files
kubectl apply -f kubernetes/deployment.yaml -f kubernetes/service.yaml

# Validate services, pods, deployments, and replica sets
kubectl get svc,pods,deployments,rs

# Get Minikube IP
minikube ip

# Expose the service - automatically open the app on the default
minikube service api-service

# IMPORTANT: keep the terminal open to maintain the service.

2. Running locally

Running locally
# Clone
git clone git@github.com:v-limo/reservations.git

# - Navigate to project
cd reservations

# - Build projects
dotnet build && dotnet restore && dotnet test

# Run project
dotnet run --project Reservations.API/Reservations.API.csproj

# Navigate to the port running the project:
http://localhost:NNNN/swagger/index.html

Running the tests

dotnet test

Authors

Vincent Limo - Github - LinkedIn

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

The API is designed to manage book reservations, providing an endpoint for all CRUD operations and additional endpoints to manage reservations and reservation history. The API is built with .NET 8 (the fastest and greatest ASP.NET core yet)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published