github.com/christoph-karpowicz/db_mediator@v0.0.0-20210207102849-61a28a1071d8/internal/server/application/front_handler.go (about)

     1  package application
     2  
     3  import (
     4  	"net/http"
     5  	"text/template"
     6  )
     7  
     8  type frontHandler struct {
     9  	app *Application
    10  }
    11  
    12  func (h *frontHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
    13  	t, _ := template.ParseFiles("web/build/index.html")
    14  	err := t.Execute(w, nil)
    15  	if err != nil {
    16  		http.Error(w, err.Error(), http.StatusInternalServerError)
    17  	}
    18  }