Giter Club home page Giter Club logo

reservations's Introduction

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 [email protected]: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 [email protected]: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

reservations's People

Stargazers

 avatar

Watchers

Lucian avatar Vincent Limo  avatar

reservations's Issues

Conver commands to a dockerfile to image

We currently have a lot of commands to run the app. Can we convert them to a Docker file then image?

git clone [email protected]:v-limo/reservations.git &&
cd reservations &&
cd Reservations.Api &&
dotnet build &&
dotnet ef migrations add InitialMigration &&
cd .. &&
docker compose -f "docker-compose.yml" up -d --build &&
open http://localhost:5165/swagger/index.html &&
cd Reservations.Api &&
dotnet ef database update

GitHub actions.

Build and test for every Pull request or commit to the main branch.

Interfaces

  • Interfaces, Generic (CRUD) and book interfcaces (extra)
  • Register all the services

Dockerize

  • The app
  • The database

With docker compose

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.