Skip to content

peanutcocktail/todo7

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimal Todo App

A tiny FastAPI-powered todo list with a clean web UI. Use the Pinokio launcher to install dependencies, start the server, update packages, or reset the environment in one click.

How to use

  • Install: Run install.js to create a virtual environment and install dependencies with uv pip install -r requirements.txt.
  • Start: Run start.js to launch the FastAPI server (daemonized). The launcher captures the printed URL and exposes an Open Web UI button once the server is ready.
  • Update: Run update.js to upgrade dependencies to the latest versions from requirements.txt.
  • Reset: Run reset.js to remove the virtual environment and Python caches if you need a clean slate.

App behavior

  • The web UI lives at / and talks to a simple JSON API.
  • Todos are stored in memory for simplicity; restarting the app clears the list.
  • The server binds to 127.0.0.1 on the next available port chosen by Pinokio.
  • UI supports a light/dark toggle that remembers your choice in local storage.

API

All endpoints are relative to the server base URL returned by start.js (for example http://127.0.0.1:8000).

List todos

GET /api/todos

Response:

[{"id":1,"title":"Example","completed":false}]

Create a todo

POST /api/todos

Body:

{"title": "Buy milk"}

Response: 201 Created with the new todo object.

Update a todo

PATCH /api/todos/{id}

Body (all fields optional):

{"title": "Buy oat milk", "completed": true}

Delete a todo

DELETE /api/todos/{id}204 No Content

Programmatic usage examples

Replace BASE_URL with the URL captured by start.js.

JavaScript (fetch)

const BASE_URL = "http://127.0.0.1:8000";

async function addTodo(title) {
  const res = await fetch(`${BASE_URL}/api/todos`, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ title }),
  });
  return res.json();
}

Python (requests)

import requests

BASE_URL = "http://127.0.0.1:8000"

resp = requests.post(f"{BASE_URL}/api/todos", json={"title": "Read docs"})
resp.raise_for_status()
print(resp.json())

cURL

curl -X POST "%BASE_URL%/api/todos" ^
  -H "Content-Type: application/json" ^
  -d "{\"title\":\"Finish tasks\"}"

On macOS/Linux:

curl -X POST "$BASE_URL/api/todos" \
  -H "Content-Type: application/json" \
  -d '{"title":"Finish tasks"}'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published