23 lines
302 B
JavaScript
23 lines
302 B
JavaScript
|
package webservice
|
||
|
|
||
|
import (
|
||
|
// Standard
|
||
|
"embed"
|
||
|
"fmt"
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
//go:embed foo.txt
|
||
|
embedded embed.FS
|
||
|
)
|
||
|
|
||
|
func staticJSWebsocket(w http.ResponseWriter, r *http.Request) {
|
||
|
contents, err := embedded.ReadFile("foo.txt")
|
||
|
if err != nil {
|
||
|
fmt.Println(err)
|
||
|
return
|
||
|
}
|
||
|
w.Write(contents)
|
||
|
}
|