// Test Go app that renders React component via Preact-RPC server.
Test Go app that renders React component via Preact-RPC server.
// Test Go app that renders React component via Preact - RPC server .
func main() {
  goclient.Connect("unix", "tmp/server.sock")
  clientJS, err := ioutil.ReadFile("./lib/example/client.js")
  if err != nil {
    panic(err)
  }
  http.HandleFunc("/", handler)
  http.HandleFunc("/client.js", func(w http.ResponseWriter, r *http.Request) {
    fmt.Fprint(w, string(clientJS))
  })
  http.ListenAndServe(":8080", nil)
}
func main ( ) { goclient . Connect ( " " , " " ) clientJS , err := ioutil . ReadFile ( " " ) if err != nil { panic ( err ) } http . HandleFunc ( " " , handler ) http . HandleFunc ( " " , func ( w http . ResponseWriter , r * http . Request ) { fmt . Fprint ( w , string ( clientJS ) ) } ) http . ListenAndServe ( " " , nil ) }
Test Go app that renders React component via Preact-RPC server.
Test Go app that renders React component via Preact - RPC server .
// Connect to the port the preact-rpc server is listening on. // Load client.js file