Compare commits
No commits in common. "4bc61ddd2073770314f54962e5aa5cc0b4bd31fd" and "026e7e010cedf545c9d251836c458d09f5f5640c" have entirely different histories.
4bc61ddd20
...
026e7e010c
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,3 @@
|
||||
.vscode
|
||||
app
|
||||
web/*.wasm
|
||||
web/
|
19
main.go
19
main.go
@ -7,6 +7,19 @@ import (
|
||||
"github.com/maxence-charriere/go-app/v9/pkg/app"
|
||||
)
|
||||
|
||||
// hello is a component that displays a simple "Hello World!". A component is a
|
||||
// customizable, independent, and reusable UI element. It is created by
|
||||
// embedding app.Compo into a struct.
|
||||
type hello struct {
|
||||
app.Compo
|
||||
}
|
||||
|
||||
// The Render method is where the component appearance is defined. Here, a
|
||||
// "Hello World!" is displayed as a heading.
|
||||
func (h *hello) Render() app.UI {
|
||||
return app.H1().Text("Hello World!")
|
||||
}
|
||||
|
||||
// The main function is the entry point where the app is configured and started.
|
||||
// It is executed in 2 different environments: A client (the web browser) and a
|
||||
// server.
|
||||
@ -37,10 +50,8 @@ func main() {
|
||||
// required resources to make it work into a web browser. Here it is
|
||||
// configured to handle requests with a path that starts with "/".
|
||||
http.Handle("/", &app.Handler{
|
||||
Name: "Internetica Galactica",
|
||||
Description: "A 1990's style PWA!",
|
||||
,
|
||||
|
||||
Name: "Hello",
|
||||
Description: "An Hello World! example",
|
||||
})
|
||||
|
||||
if err := http.ListenAndServe(":8000", nil); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user