directory
Version:
v0.1.22
Opens a new window with list of versions in this module.
Published: Feb 20, 2026
License: MIT
Opens a new window with license information.
README
¶
Fetch Example
This example demonstrates how to use fetchgo to send binary data (TinyBin) from a Go/WASM client to a Go server.
Structure
client.go: WASM client that uses fetchgo to send a User struct.
server.go: HTTP server that receives and decodes the User struct using tinybin.
ui/: Static HTML/CSS files.
Running the Example
Assuming you have the golite environment set up:
-
Start the development server:
# From the example/web directory
golite
-
Open your browser at the provided URL (usually http://localhost:6060).
-
Click the "Send User Data" button to trigger the binary request.
How it works
- The client creates a
User struct.
fetchgo.SendBinary automatically encodes the struct using TinyBin.
- The browser sends the binary data via HTTP POST.
- The server receives the request and decodes the body using
tinybin.Decode.
- The server responds with a text message.
Directories
¶
Click to show internal directories.
Click to hide internal directories.