Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.56 KB | None | 0 0
  1. package home
  2.  
  3. import (
  4.     "html/template"
  5.     "log"
  6.     "net/http"
  7.     "scarga/app/models/claims"
  8. )
  9.  
  10. func Controller(w http.ResponseWriter, r *http.Request) {
  11.  
  12.     cl, err := claims.GetAll()
  13.     if err != nil {
  14.         log.Println(err)
  15.         http.Error(w, err.Error(), 500)
  16.         return
  17.     }
  18.  
  19.     t, err := template.ParseFiles("./resources/views/index.html")
  20.     if err != nil {
  21.         http.Error(w, err.Error(), 500)
  22.         return
  23.     }
  24.  
  25.     err = t.ExecuteTemplate(w, "index", cl)
  26.     if err != nil {
  27.         log.Println(err)
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement