https://github.com/pjtunstall/penumbra
A task manager web app, written mostly in Go, using Go's HTML templates, with minimal JavaScript, and the DaisyUI CSS framework for styling.
https://github.com/pjtunstall/penumbra
api go golang rest-api sql sqlite
Last synced: about 2 months ago
JSON representation
A task manager web app, written mostly in Go, using Go's HTML templates, with minimal JavaScript, and the DaisyUI CSS framework for styling.
- Host: GitHub
- URL: https://github.com/pjtunstall/penumbra
- Owner: pjtunstall
- Created: 2025-04-19T16:25:11.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-11T19:57:24.000Z (about 1 year ago)
- Last Synced: 2025-05-21T07:14:50.199Z (about 1 year ago)
- Topics: api, go, golang, rest-api, sql, sqlite
- Language: Go
- Homepage:
- Size: 121 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PENUMBRA
- [Overview](#overview)
- [Project status](#project-status)
- [Usage](#usage)
- [Routes](#routes)
## Overview
A task-manager app written in Go as a learning exercise.
## Project status
This project should be considered incomplete if any `TODO` remains in the actual code. Any CI/Cd pipeline should enforce that.
## Usage
Dowload and install the [Go programming language](https://go.dev/doc/install) if you haven't already.
To initialize a database, compile the dbinit binary with `go build -o dbinit cmd/dbinit/main.go` and run it `./dbinit` (or the equivalent command for your operating system). This will initialize a database called `dev.db` in a newly created `data` directory in the root of this project.
Then to build and run the app in one step, run `go run cmd/webapp/main.go` (assuming your working directory is the project root). Open a web browser and navigate to `http://localhost:8080`.
To run all tests, run `go test ./...`.
## Routes
- `GET /` – redirect to `/login` if not logged in, otherwise redirect to `/dashboard`
- `GET /login` – show login form
- `POST /login` – submit login form
- `GET /register` - show register form
- `POST /register` - submit register form
- `GET /dashboard` - show dashboard, listing any task titles, due datss, and status, with the option to mark them as done
- `GET /about` - show about page
- `GET /logout` - log out and redirect to `/login`
- `GET /tasks` - list all tasks for the current user, including descriptions, due dates, and status
- `GET /tasks/create` - show form to create new task
- `POST /tasks/create` - submit form to create new task
- `GET /tasks/{id}` - show task details, including description, due date, and status in a form that allows the task to be deleted, or edited and updated.
- `POST /tasks/delete/{id}` - delete task
- `POST /tasks/done/{id}` - mark task as done
- `POST /tasks/update/{id}` - submit form to update task
Regarding the choice of names, Chat remarks:
> You're following a classic HTML form-based pattern, and it's perfectly fine for a traditional server-rendered app. REST purists would nudge you toward resource-based paths and HTTP verbs, but in practice for web apps, what you're doing is conventional and user-friendly.
>
> That said, here's how you could tweak your route names to better align with REST conventions while still supporting HTML forms:
>
> | Purpose | Current Route | Suggested REST-style Route | Notes |
> | -------------------------- | ----------------------- | --------------------------------------------------------- | ----------------------------------------------------------------- |
> | Show empty "new task" form | GET /tasks/create | GET /tasks/new | `new` is a common REST-y way to signal a form for creation |
> | Submit new task form | POST /tasks/create | POST /tasks | REST uses POST to the collection to create |
> | Show edit task form | GET /tasks/{id} | GET /tasks/{id}/edit | `edit` is a conventional form path in REST-style HTML apps |
> | Submit task update | POST /tasks/update | POST /tasks/{id} or /{id}/update | Use POST with clear naming since browsers don’t support PUT/PATCH |
> | Delete/update UI | Part of GET /tasks/{id} | Consider GET /tasks/{id}/edit and POST /tasks/{id}/delete | Split views/actions for clarity |