summaryrefslogtreecommitdiff
path: root/tidsreg.go
diff options
context:
space:
mode:
Diffstat (limited to 'tidsreg.go')
-rw-r--r--tidsreg.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/tidsreg.go b/tidsreg.go
new file mode 100644
index 0000000..9821672
--- /dev/null
+++ b/tidsreg.go
@@ -0,0 +1,37 @@
+package main
+
+import (
+ "fmt"
+ "log"
+ "net/http"
+ "text/template"
+)
+
+type Server struct {
+ template *template.Template
+}
+
+func (c *Server) rootHandle(w http.ResponseWriter, r * http.Request) {
+ tmpl, err := template.ParseFiles("templates/index.html")
+ if err != nil {
+ log.Println(err)
+ return
+ }
+ tmpl.Execute(w, nil)
+}
+
+func main() {
+ fmt.Println("Hello world!")
+
+ template, err := template.ParseFS(templates, "templates/*.html")
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ s := Server {
+ template: template,
+ }
+
+ http.HandleFunc("/", s.rootHandle)
+ log.Fatal(http.ListenAndServe(":8080", nil))
+}