Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/v7e5/bareapi_asp_core
An example of a barebones ultra minimal todo list api using ASP.NET Core minimal webapi with simple cookie-based auth and zero dependencies.
https://github.com/v7e5/bareapi_asp_core
api asp-net-core aspnetcore barebones csharp dotnet dotnet-core minimal minimal-api rest-api sqlite sqlite3 todolist webapi
Last synced: about 1 month ago
JSON representation
An example of a barebones ultra minimal todo list api using ASP.NET Core minimal webapi with simple cookie-based auth and zero dependencies.
- Host: GitHub
- URL: https://github.com/v7e5/bareapi_asp_core
- Owner: v7e5
- Created: 2024-08-19T12:00:05.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2024-09-28T08:16:46.000Z (about 2 months ago)
- Last Synced: 2024-09-30T11:02:14.599Z (about 2 months ago)
- Topics: api, asp-net-core, aspnetcore, barebones, csharp, dotnet, dotnet-core, minimal, minimal-api, rest-api, sqlite, sqlite3, todolist, webapi
- Language: Shell
- Homepage:
- Size: 2.53 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Barebones Todo Minimal API - ASP.NET Core 8 (SQlite)
A sample minimal todo list api in C# with ASP.NET Core 8. This project uses
SQlite for database. Check out
[/v7e5/bareapi_asp_core_mssql](https://github.com/v7e5/bareapi_asp_core_mssql)
for a version that uses SQLServer/MSSQL.## Features
+ Builds on the bare minimum `WebApplication.CreateEmptyBuilder`
+ Implements a simple cookie based user authentication / session using raw http
headers, backed by a session table in the database.
+ Avoids the complexity and ceremony of EFCore/ORMs in favor of raw sql queries/ADO.NET.
+ Uses sqlite for database. `Microsoft.Data.Sqlite` is the only required package dependency.
+ Implements keyset/cursor based pagination for the todo/list route**Note**: I've used synchronous ADO.NET methods instead of
the preferred asynchronous variants for reasons detailed here.
https://learn.microsoft.com/en-us/dotnet/standard/data/sqlite/asyncThe shell scripts in misc are intended to be run in a zsh shell on linux. They
include convenience functions for building / executing as well as testing the
routes using curl. Feel free to ignore them if they don't match your use case.## Endpoints
### Auth
#### login
POST: `/login`Example request:
```shell
curl -vs -X POST \
--cookie ${COOKIE_FILE_PATH} \
--cookie-jar ${COOKIE_FILE_PATH} \
-H 'content-type: application/json' \
-H 'accept: application/json' \
--data-binary "$(cat <