added to README-wasm.md

This commit is contained in:
Ahoys123 2023-01-09 18:11:47 -08:00 committed by Garrett D'Amore
parent 0851813f48
commit fade40c650
1 changed files with 11 additions and 4 deletions

View File

@ -39,10 +39,11 @@ import (
)
func main() {
log.Fatal(http.ListenAndServe(":8080",
http.FileServer(http.Dir("/path/to/dir/to/serve"))
))
log.Fatal(http.ListenAndServe(":8080",
http.FileServer(http.Dir("/path/to/dir/to/serve")),
))
}
```
To see the webpage with this example, you can type in `localhost:8080/tcell.html` into your browser while `server.go` is running.
@ -51,4 +52,10 @@ To see the webpage with this example, you can type in `localhost:8080/tcell.html
It is recomended to use an iframe if you want to embed the app into a webpage:
```html
<iframe src="tcell.html" title="Tcell app"></iframe>
```
```
## Other considerations
### Accessing files
`io.Open(filename)` and other related functions for reading file systems do not work; use `http.Get(filename)` instead.