Move writeError to api.go

Web interface now uses error HTML template instead.
master
Alexey Yerin 1 year ago
parent b67c4398fc
commit e1c610caf9
  1. 5
      api.go
  2. 11
      utils.go

@ -5,6 +5,11 @@ import (
"net/http"
)
func writeError(w http.ResponseWriter, status int, err interface{}) {
w.WriteHeader(status)
fmt.Fprintln(w, err)
}
func CreateApiHandler(settings *TranslateSettings) func(w http.ResponseWriter, req *http.Request) {
return func(w http.ResponseWriter, req *http.Request) {
from := req.FormValue("from")

@ -1,11 +0,0 @@
package main
import (
"fmt"
"net/http"
)
func writeError(w http.ResponseWriter, status int, err interface{}) {
w.WriteHeader(status)
fmt.Fprintln(w, err)
}
Loading…
Cancel
Save