Skip to content
프로젝트

wolfeidau/hotwire-golang-website

GitHub에서 보기

소개

This project provides some working examples using Go and Hotwire Turbo.

학습 및 교육

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

hotwire-golang-website

This project provides some working examples using Go the hotwire/turbo library published by basecamp. This is based on a great post about Hotwire: HTML Over The Wire by @delitescere.

Overview

This service illustrates how to use turbo to enable updates to a website using primarily service side code.

  1. Uses html/template via my helper library echo-go-templates which provides layout helpers, and embedded assets with io/fs for views.
  2. Uses echo library to simplify routing.
  3. Uses a CDN to host all css / JS libraries base.html.
  4. Uses esbuild to automatically bundle JS assets on startup using echo-esbuild-middleware to serve them.

Hotwire Turbo

In this site I have implemented:

  1. Turbo Drive
  2. Turbo Frames
  3. Turbo Streams with Server Sent Events (SSE) and WebSockets
  4. stimulus

Most of the server side logic is in hotwire.go.

Prerequisites

  • Go 1.13 or later with support for Go Modules, used to build the service.
  • Node.js 12 or later, which is only used to install our asset building dependencies.

Running

To get this project running you need to setup some certificates, in my case I use https://github.com/FiloSottile/mkcert and there is a target in the makefile.

make certs

To install node dependencies

make install

To start the service just run.

make start

For development you can use the following command, this will check for code updates and restart the service.

make watch

The service should be listening on https://hotwire.localhost:9443/

License

This application is released under Apache 2.0 license and is copyright Mark Wolfe.

관련 프로젝트 살펴보기

불러오는 중…