{"id":15066114,"url":"https://github.com/v7e5/bareapi_asp_core","last_synced_at":"2025-07-31T08:41:24.020Z","repository":{"id":254253813,"uuid":"844506285","full_name":"v7e5/bareapi_asp_core","owner":"v7e5","description":"An example of a barebones ultra minimal todo list api using ASP.NET Core minimal webapi with simple cookie-based auth and zero dependencies.","archived":false,"fork":false,"pushed_at":"2024-11-12T16:40:37.000Z","size":2681,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-12T17:36:03.810Z","etag":null,"topics":["api","asp-net-core","aspnetcore","barebones","csharp","dotnet","dotnet-core","minimal","minimal-api","rest-api","sqlite","sqlite3","todolist","webapi"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/v7e5.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-19T12:00:05.000Z","updated_at":"2024-11-12T16:40:41.000Z","dependencies_parsed_at":"2024-08-22T10:32:17.341Z","dependency_job_id":"8f187b10-dae4-45a9-8936-34a315ef850d","html_url":"https://github.com/v7e5/bareapi_asp_core","commit_stats":null,"previous_names":["v7e5/bareapi_asp_core"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v7e5%2Fbareapi_asp_core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v7e5%2Fbareapi_asp_core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v7e5%2Fbareapi_asp_core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v7e5%2Fbareapi_asp_core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/v7e5","download_url":"https://codeload.github.com/v7e5/bareapi_asp_core/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225814860,"owners_count":17528295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","asp-net-core","aspnetcore","barebones","csharp","dotnet","dotnet-core","minimal","minimal-api","rest-api","sqlite","sqlite3","todolist","webapi"],"created_at":"2024-09-25T01:01:49.132Z","updated_at":"2024-11-21T22:50:26.979Z","avatar_url":"https://github.com/v7e5.png","language":"Shell","readme":"# Barebones Todo Minimal API - ASP.NET Core 8 (SQlite)\n\nA sample minimal todo list api in C# with ASP.NET Core 8. This project uses\nSQlite for database. Check out\n[/v7e5/bareapi_asp_core_mssql](https://github.com/v7e5/bareapi_asp_core_mssql)\nfor a version that uses SQLServer/MSSQL.\n\n## Features\n+ Builds on the bare minimum `WebApplication.CreateEmptyBuilder`\n+ Implements a simple cookie based user authentication / session using raw http\nheaders, backed by a session table in the database.\n+ Avoids the complexity and ceremony of EFCore/ORMs in favor of raw sql queries/ADO.NET.\n+ Uses sqlite for database. `Microsoft.Data.Sqlite` is the only required package dependency. \n+ Implements keyset/cursor based pagination for the todo/list route \n\n**Note**: I've used synchronous ADO.NET methods instead of \nthe preferred asynchronous variants for reasons detailed here. \nhttps://learn.microsoft.com/en-us/dotnet/standard/data/sqlite/async\n\nThe shell scripts in misc are intended to be run in a zsh shell on linux. They\ninclude convenience functions for building / executing as well as testing the\nroutes using curl. Feel free to ignore them if they don't match your use case.\n\n## Endpoints\n\n### Auth\n\n#### login\nPOST: `/login`\n\nExample request:\n```shell\ncurl -vs -X POST \\\n  --cookie ${COOKIE_FILE_PATH} \\\n  --cookie-jar ${COOKIE_FILE_PATH} \\\n  -H 'content-type: application/json' \\\n  -H 'accept: application/json' \\\n  --data-binary \"$(cat \u003c\u003cEOL\n{\n  \"username\": string (required),\n  \"password\": string (required)\n}\nEOL\n)\" \\\n'http://0.0.0.0:8000/login'\n\n```\n\n#### logout\nPOST: `/logout`\n\nExample request:\n```shell\ncurl -vs -X POST \\\n  --cookie ${COOKIE_FILE_PATH} \\\n  --cookie-jar ${COOKIE_FILE_PATH} \\\n  -H 'content-type: application/json' \\\n  -H 'accept: application/json' \\\n'http://0.0.0.0:8000/logout'\n\n```\n\n### Todos\n\n#### todo: list\nPOST: `/todo/list`\n\nThis route implements keyset pagination. It is controlled by three optional\nparameters: `cursor_init`, `cursor_prev` and `cursor_next`. Initial \nrequest without any parameters returns a JSON response something like this:\n```json\n{\n  \"data\": [ // array of todos\n    {todo object}\n  ],\n  \"cursor_init\": // index of first row (return with every next/prev request),\n  \"cursor_prev\": //index of last page, use to go back (is null for first page)\n  \"cursor_next\": //index for next page, use to go forward,\n}\n```\nInclude one of either `cursor_next` or `cursor_prev` along with `cursor_init`.\nTo go forward, include the `cursor_next` param in your request, which you\nwill have recieved from an earlier request. To go back, send `cursor_prev`.\nThe value for `cursor_init` does not change for a given query. It is used as an\nanchor to determine if there are any rows while going backwards.\n\nExample request:\n```shell\ncurl -vs -X POST \\\n  --cookie ${COOKIE_FILE_PATH} \\\n  --cookie-jar ${COOKIE_FILE_PATH} \\\n  -H 'content-type: application/json' \\\n  -H 'accept: application/json' \\\n  --data-binary \"$(cat \u003c\u003cEOL\n{\n  \"id\": long (optional),\n  \"task\": string (optional),\n  \"done\": bool (optional),\n  \"due_from\": unix timestamp (long, optional),\n  \"due_to\": unix timestamp (long, optional),\n  \"categories\": [array of category ids (long, optional)],\n  \"cursor_init\": long (optional),\n  \"cursor_next\": long (optional),\n  \"cursor_prev\": long (optional)\n}\nEOL\n)\" \\\n'http://0.0.0.0:8000/todo/list'\n\n```\n\n#### todo: create\nPOST: `/todo/create`\n\n```json\n{\n  \"task\": string (required),\n  \"done\": bool (optional),\n  \"due\": unix timestamp (long, optional),\n  \"categories\": [array of category ids (long, optional)]\n}\n```\n\n#### todo: update\nPOST: `/todo/update`\n\n```json\n{\n  \"id\": long (required),\n  \"task\": string,\n  \"done\": bool,\n  \"due\": unix timestamp,\n  \"categories\": [array of category ids]\n}\n```\n\n#### todo: delete\nPOST: `/todo/delete`\n\n```json\n{\n  \"id\": long (required)\n}\n```\n\n### Users\n\n#### user: create\nPOST: `/user/create`\n\n```json\n{\n  \"username\": string (required),\n  \"password\": string (required)\n}\n```\n\n#### user: delete\nPOST: `/user/delete`\n\n```json\n{\n  \"id\": long (required)\n}\n```\n#### user: list\nPOST: `/user/list`\n\n```json\n{\n  \"id\": long (optional),\n  \"username\": string (optional)\n}\n```\n\n### Categories\n\n#### category: create\nPOST: `/category/create`\n\n```json\n[\n  {\"name\":\"bug\",\"color\":\"d73a4a\"},\n  {\"name\":\"duplicate\",\"color\":\"cfd3d7\"}\n]\n```\n\n#### category: list\nPOST: `/category/list`\n\n```json\n{\n  \"id\": long (optional),\n  \"name\": string (optional),\n  \"color\": string (optional)\n}\n```\n\n#### category: update\nPOST: `/category/update`\n\n```json\n{\n  \"id\": long (required),\n  \"name\": string,\n  \"color\": string\n}\n```\n\n#### category: delete\nPOST: `/category/delete`\n\n```json\n{\n  \"id\": long (required)\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv7e5%2Fbareapi_asp_core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fv7e5%2Fbareapi_asp_core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv7e5%2Fbareapi_asp_core/lists"}