Skip to content

serjKim/CarParking

Repository files navigation

CarParking

A "real" web app written on F#.

Description

The goal is to demonstrate an interaction between F#, SQL database and frontend part.

Solution Structure

  • CarParking.Core
  • A pure layer containing the domain types and business logic.
  • CarParking.DataLayer
  • Commands/queries over the SQL Database, using Dapper.
  • CarParking.Workflow
  • A layer describes the full business workflow compositing impure and pure things rather than mixing. The idea is based on Dependency Rejection approach.
  • CarParking.Error
  • Application errors.
  • CarParking.WebApi
  • A Giraffe web server. The api handlers calls the CarParking.Workflow directly.
  • CarParking.WebUI
  • A web server (Razor pages) serving an angular app.
  • CarParking.Workflow.IntegrationTests
  • Property-based integration testing

How it works

workflow

Requirements

  • .NET Core >= 5.0
  • Docker >= 19
  • (Optional) Paket: You can get all dependencies using dotnet restore without having Paket, since there is the .paket/Paket.Restore.targets file Revert back later :)
  • (Optional) Node >= 12.14, npm >= 6.13: Required if there is a desire to build UI

Getting Started

  1. Build the database
docker-compose build
docker-compose up database
  1. Build the Web api
cd CarParking.WebApi
dotnet run
  1. Web api is ready for work. That's enough to be able to use Postman or other client to play with the api. postman_calls.json - a collection of api calls intended to be imported to Postman.

Build UI

  1. Build the Angular app
cd CarParking.WebUI\frontend
npm i
npm run build
  1. Run the Web server
cd CarParking.WebUI
dotnet run
  1. Open https://localhost:5051/
  2. Enjoy

Run Integration Tests

docker-compose up database_tests
dotnet test -v n

Inspired By

Articles

Video