DavidAJohn / BookwormsLendingLibrary

Blazor Server client UI with a .NET Web API backend for an imaginary online library.
https://bookwormslibrary.azurewebsites.net
6 stars 4 forks source link
asp-net-core blazor blazor-server books bootstrap5 bunit csharp dotnet dotnet-core dotnet-core-webapi entity-framework-core library sql-server webapi webapi-2

Bookworms Lending Library

Bookworms Lending Library is a .NET application that combines a Blazor Server frontend with a Web API backend. It was built for an imaginary online library that mails books out to its borrowers.

This is an experimental project. It was not created with the aim of becoming a production-ready enterprise solution and it should not be used as the basis for a production application.

BookwormsUI project Build Status:

Build Status - BookwormsUI

BookwormsAPI project Build Status:

Build Status - BookwormsAPI

You can see a demo version of the site running on Microsoft Azure at: https://bookwormslibrary.azurewebsites.net

Screenshot

Features

Setup

To run the application on your local machine, after cloning or downloading it from GitHub, you'll need the following:

If you're using Visual Studio (not VS Code) as your code editor, you will need to be running the 2022 version (or higher). The free Community Edition is sufficient to run this application.

Assuming that you have Docker Desktop installed and running, to create a container using the official Microsoft SQL Server 2017 Docker image, either enter the following from a terminal (all on one line):

docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=P@ssw0rd1234" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-latest

or

you can make use of the docker-compose.yml file in the root directory of the application, and enter the following from a terminal window from within the application's root:

docker-compose up -d

The official Microsoft SQL Server 2017 image is 1.4Gb, so if you don't already have it downloaded in Docker this could take a few minutes, depending on the speed of your internet connection.

The application is set up to use this Docker container to provide its database, so if you use a local installation of SQL Server instead, you'll need to adjust the database connection strings in the appsettings.Development.json file in the BookwormsAPI folder accordingly.

This is a Blazor Server application. Both the UI and API projects will need to be running at the same time (unless you simply want to test the API in a separate client application such as Postman).

In Visual Studio 2022, you will need to set it to run multiple startup projects and select both the BookwormsUI and BookwormsAPI projects.

In Visual Studio Code, you will need two terminal windows. One where you 'cd' into the BookwormsAPI folder and then type 'dotnet run', and one where you do the same for the BookwormsUI folder.

The first time the application runs, it will seed sample book and author data into your database.

It also creates an admin login automatically. The login details can be found in the appsettings.Development.json file in the BookwormsAPI folder. This should obviously only be used during development and testing and not in production.