goponents

command module
v0.0.0-...-515d911 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 5 Imported by: 0

README

GOponents

A technology demonstrator for

  • GO with auto-reloading via air
  • HTMX with browser reloading via browser-sync
  • HyperScript with built-in support for Server Sent Events
  • TailwindCSS with auto-reloading
  • daisyUI nice, modern UI with themes, and more

One of the main principles of HTMX is HATEOAS (Hypermedia as the engine of application state).

Simply put, state is maintained on the server, not the client.

This is demonstrated here in several ways. Theme and (current) Module have their state maintained on the server. This allows the user to reload the page, withOUT losing state.

TODOS

  • refactor handlers, need a few generic utils to reduce boilerplate
  • add SQLlite repository demo

Installing and Running

You will need GO installed. I highly recommend using gobrew

Install using curl

curl -sLk https://raw.githubusercontent.com/kevincobain2000/gobrew/master/git.io.sh | sh
# list remote versions available
gobrew ls-remote
# install the latest non-beta release (1.21.4 as of 2023-11-20)
gobrew install 1.21.4

You will also need MongoDB and Redis. On macOs I recommend the following:

# install MongoDB community edition ( for local testing )
brew tap mongodb/brew
brew update
brew install mongodb-community
brew services start mongodb-community
# install Redis
brew install redis
brew services start redis

Install dependencies

# install npm packages (tailwindcss, postcss, browser-sync, etc.)
# yes, HTMX is mostly Javascript-less, but some development packages are needed
npm install

Then run the following from a terminal window:

# run air, tailwind watcher concurrently
source ./dev.sh

The site should now be available at http://localhost:3000

Datastores

Both Redis and MonoDB-Community are in use. This shows how to use multiples data repositories and how to abstract the datastore mechanisms away from the web handlers.

A SQLLite example is planned.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
pkg
sse
Package sse implements Server-Sent Events that supports multiple channels.
Package sse implements Server-Sent Events that supports multiple channels.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL