The TodoHub is a Web server application to demonstrate the features of the JSON Fliox .NET library.
In short
JSON Fliox is .NET library supporting simple and efficient access to SQL & NoSQL databases via C# or Web clients.
For a simple setup the server is also the database storing records (entities) in the file-system.
This enables running the server without any configuration or installation of a third party DBMS (database management system).
The key class when running a HTTP server using Fliox Hub is TodoClient.cs.
This class provide two fundamental functionalities:
- It is a database client providing type-safe access to its containers, commands and messages
- It defines a database schema by declaring its containers, commands and messages.
The schema is used by host for entity validation and exposing the schema in various formats:
JSON Schema, OpenAPI, GraphQL, HTML, Typescript, C# & Kotlin.
π Client
β£ π TodoClient.cs 1. is a database client
β 2. is a database schema for a Hub
π Hub
β£ π Program.cs bootstrapping & configuration of host > dotnet run
β£ π Provider.cs use DB provider: memory, file, SQLite, MySQL, MariaDB, PostgreSQL or SQL Server
β£ π Startup.cs ASP.NET Core 6.0 integration
π Test
β£ π TodoTests.cs unit tests > dotnet test
β π Trial.cs small samples > dotnet run
The solution and its projects can be build, tested and executed on Windows, Linux, and macOS.
It can be used with following IDE's:
Visual Studio Code,
Rider &
Visual Studio 2022.
Note: In order to build and run the examples the .NET 6.0 SDK is required.
Or use Gitpod to build and run the server using VSCode in the browser without installing anything.
Workspace available in 30 sec. Open
in new tab. When Finished open Terminal panel.
clone repository and open its directory - leave out this step when using Gitpod.
git clone git@github.com:friflo/Fliox.Example.TodoDB.git
cd Fliox.Example.TodoDB
build all examples
dotnet build
β©
Build succeeded.
0 Warning(s)
0 Error(s)
run unit tests of all examples
dotnet test
β©
Passed! - Failed: 0, Passed: 7, Skipped: 0, Total: 7, Duration: 421 ms - TodoTest.dll (net6.0)
run a Hub as an HTTP server from its folder - e.g.
cd ./Hub
dotnet run
the server will start with logs like
info: add extension db: 'cluster' (in-memory)
info: create HttpHost db: 'main_db' (file-system)
info: TodoDB Β· dev - v1.0.0, Friflo.Json.Fliox - v0.42.0
____ _ _
| __| | | |_| ____ __ __
| _| | | | | | __ | \ \/ /
|_| |_| |_| |____| /_/\_\ .oOo. ..oo. .oOOo..
...
Hub Explorer - http://localhost:8010/fliox/
when using Gitpod:
- Click Make Public
- Click
http://localhost:8010/fliox/
in Terminal
Otherwise open the Hub Explorer in your browser: http://localhost:8010/fliox/
run the .NET Test client accessing the Hub from its folder - e.g.
cd ./Test
dotnet run
β©
--- jobs:
id: 1, title: buy milk, completed: False
id: 2, title: buy cheese, completed: True
wait for events ... (exit with: CTRL + C)
note: generate events by clicking 'Save' on a record in the Hub Explorer
It will execute the client methods used in Trial.Main()