Common isomorphic functionality in one kit.

gopherjshandlers.go 459B

12345678910111213141516171819
  1. // +build !clientonly
  2. package isokit
  3. import (
  4. "net/http"
  5. )
  6. func GopherjsScriptHandler(webAppRoot string) http.Handler {
  7. return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
  8. http.ServeFile(w, r, webAppRoot+"/client/client.js")
  9. })
  10. }
  11. func GopherjsScriptMapHandler(webAppRoot string) http.Handler {
  12. return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
  13. http.ServeFile(w, r, webAppRoot+"/client/client.js.map")
  14. })
  15. }