You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<a href="https://opencollective.com/go-app" alt="Financial Contributors on Open Collective"><img src="https://opencollective.com/go-app/all/badge.svg?label=open+collective&color=4FB9F6" /></a>
14
14
</p>
15
15
16
-
**go-app** is a package to build [progressive web apps (PWA)](https://developers.google.com/web/progressive-web-apps/) with [Go programming language](https://golang.org) and [WebAssembly](https://webassembly.org).
16
+
Go-app is a package for **building progressive web apps (PWA)** with the [Go programming language (Golang)](https://golang.org) and [WebAssembly (Wasm)](https://webassembly.org).
17
17
18
-
It uses a [declarative syntax](#declarative-syntax) that allows creating and dealing with HTML elements only by using Go, and without writing any HTML markup.
18
+
Shaping a UI is done by using a **[declarative syntax](/syntax) that creates and compose HTML elements only by using the Go programing language**.
19
19
20
-
The package also provides an [http.handler](#http-handler) ready to serve all the required resources to run Go-based progressive web apps.
20
+
It **uses [Go HTTP standard](https://golang.org/pkg/net/http) model**.
21
+
22
+
An app created with go-app can out of the box **run in its own window**, **supports offline mode**, and are **SEO friendly**.
The app is built with the Go build tool by specifying WebAssembly as architecture and javascript as operating system:
102
-
103
-
```sh
104
-
GOARCH=wasm GOOS=js go build -o app.wasm
105
73
```
106
74
107
-
Note that the build output is named `app.wasm` because the HTTP handler expects the wasm app to be named that way in order to serve its content.
75
+
## Standard HTTP
108
76
109
-
### HTTP handler
110
-
111
-
Once the wasm app is built, the next step is to serve it.
112
-
113
-
This package provides an [http.Handler implementation](https://pkg.go.dev/github.com/maxence-charriere/go-app/pkg/app#Handler) ready to serve a PWA and all the required resources to make it work in a web browser.
114
-
115
-
The handler can be used to create either a web server or a cloud function (AWS Lambda, Google Cloud function or Azure function).
77
+
Apps created with go-app complies with [Go standard HTTP](https://golang.org/pkg/net/http) package interfaces.
Once the server and the wasm app built, `app.wasm` must be moved in the `web` directory, located by the side of the server binary. The web directory is where to put static resources, such as the wasm app, styles, scripts, or images.
145
-
146
-
The directory should look like as the following:
147
-
148
-
```sh
149
-
.# Directory root
150
-
├── hello # Server binary
151
-
├── main.go # Server source code
152
-
└── web # Directory for static resources
153
-
└── app.wasm # Wasm binary
154
-
```
155
-
156
-
Then launch the `hello` server and open the web browser to see the result.
157
-
158
-
Demo code and live demo are available on the following links:
0 commit comments