Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.66 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "html/template"
  5.     "log"
  6.     "net/http"
  7. )
  8.  
  9. var tpl *template.Template
  10.  
  11. func init() {
  12.     tpl = template.Must(template.ParseGlob("templates/*.gohtml"))
  13. }
  14.  
  15. func main() {
  16.     // CSS
  17.     http.Handle("/static/css", http.StripPrefix("/static/css/", http.FileServer(http.Dir("static/css/style.css"))))
  18.     // JS
  19.     http.Handle("/static/js", http.StripPrefix("/static/js/", http.FileServer(http.Dir("static/js/script.js"))))
  20.     // Sem favicon.ico - Retorna 404
  21.     http.Handle("/favicon.ico", http.NotFoundHandler())
  22.  
  23.     http.HandleFunc("/", index)
  24.  
  25.     log.Fatalln(http.ListenAndServe(":8080", nil))
  26. }
  27.  
  28. func index(w http.ResponseWriter, r *http.Request) {
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement