gotodo/README.md

73 lines
1.8 KiB
Markdown
Raw Normal View History

2023-09-03 02:12:43 +02:00
# Todo App with GO and HTMX
2023-09-04 13:29:40 +02:00
Goal: make a todo app with minimal reliance on other libraries and frameworks.
I'll assume that it is a single user app so I do not have to worry about concurrent access, high throughput,
etc..
2023-09-03 13:45:51 +02:00
## Plan day 1
2023-09-03 02:12:43 +02:00
- [x] create Go webserver
- [x] create landing page
- [x] import HTMX code
- [x] display todo list
2023-09-03 13:45:51 +02:00
- [x] add tailwind CSS
- [x] show todo list
- [x] let todos be marked completed
- [x] remove todos
- [x] add new todo with form
- [x] persist todos in redis
- [x] spruce up
2023-09-03 02:12:43 +02:00
2023-09-04 13:29:40 +02:00
2023-09-03 13:45:51 +02:00
## Plan day 2
2023-09-04 13:29:40 +02:00
make it use only battery included features
2023-09-03 13:45:51 +02:00
i.e. replace redis with an event driven approach
- [x] modularize app
- [x] replace redis with json stream
- [x] use hashmap for fast individual access
2023-09-04 13:29:40 +02:00
- [x] cache data to avoid reading each time
- [x] create event store
- [x] make events
- [x] implement event store
## Usage tips
### Running the app locally
Install *air* from [cosmtrek/air github repo](https://github.com/cosmtrek/air) with `go install github.com/cosmtrek/air@latest` or use the provided install bash scripts. This tool will watch for changes in the project folder and rebuild and restart the app during development (at least most of the time)
2023-09-04 13:41:33 +02:00
then in the root folder
air
and check for errors. Normally the site will now answer on [port 8080.](http://localhost:8080)
### Updating CSS with tailwind
Just add tailwind tags to the *class* attributes per documentation
then in the root folder:
npx tailwindcss -i ./src/input.css -o ./static/output.css --watch
Same deal, it will monitor changes in the templates and regenerate the output.css on the fly.
2023-09-04 16:36:37 +02:00
### Makefile
I added a makefile to not have to remember the command lines :
make tailwind
starts the CSS generator
and
make air
starts the go watcher builder although I do not know why anyone wants to type the 5 extra chars.