https://github.com/vildan-valeev/golang-htmx-grpc
Example for test HTMX with gRPC-web
https://github.com/vildan-valeev/golang-htmx-grpc
envoy golang grpc-web htmx javascript protobuf
Last synced: 6 months ago
JSON representation
Example for test HTMX with gRPC-web
- Host: GitHub
- URL: https://github.com/vildan-valeev/golang-htmx-grpc
- Owner: vildan-valeev
- License: mit
- Created: 2024-02-13T21:16:50.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-23T22:21:59.000Z (over 1 year ago)
- Last Synced: 2025-04-10T23:52:02.937Z (6 months ago)
- Topics: envoy, golang, grpc-web, htmx, javascript, protobuf
- Language: JavaScript
- Homepage:
- Size: 6.52 MB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple Project for testing [HTMX](https://htmx.org/docs/) with [gRPC-Web](https://github.com/grpc/grpc-web/tree/master)
---
Sending HTML code parts from the backend as a string and inserting them into the DOM using htmx.1. https://htmx.org/docs/#extensions
2. https://github.com/grpc/grpc-web/tree/master/net/grpc/gateway/examples/helloworld#compile-the-client-javascript-code
3.---
### Start
1. Generate js from proto file (optional, if doesn't exist `api_pb.js`, `api_pb_web.js`)
```sh
make js-proto
```
2. Generate go package from proto file (optional, if doesn't exist `api.pb.go`, `api_grpc.pb.go`)
```sh
make go-proto
```
3. Compile the client side JavaScript (optional, if doesn't exist `main.js`)
```sh
browserify grpc_ext.js -o main.js
```
4. Run Proxy Server
```sh
docker compose up --build --remove-orphans
```
5. Start Backend
```sh
go mod tidy
go build -o main main.go
./main
```
6. Open `index.html` in Browser