Browse Source

Voeg plaatjes en kleuren toe aan ex6

Harry de Boer 9 years ago
parent
commit
9aa59cba83

+ 7 - 2
.gitignore

@@ -1,4 +1,9 @@
 .idea
 *.iml
-ex1-hello/ex1-hello
-ex2-hello/ex2-hello
+ex1/ex1
+ex2/ex2
+ex3/ex3
+ex4/ex4
+ex5/ex5
+ex6/ex6
+ex7/ex7

+ 0 - 0
ex1-hello/main.go → ex1/main.go


+ 0 - 0
ex2-hello/main.go → ex2/main.go


BIN
ex3-hello/ex3-hello


+ 0 - 0
ex3-hello/main.go → ex3/main.go


+ 0 - 0
ex4-hello/main.go → ex4/main.go


+ 0 - 0
ex4-hello/templates/hello.tpl → ex4/templates/hello.tpl


+ 0 - 0
ex5-hello/main.go → ex5/main.go


+ 0 - 0
ex5-hello/templates/hello.tpl → ex5/templates/hello.tpl


BIN
ex6-hello/ex6-hello


+ 0 - 3
ex6-hello/resource/main.css

@@ -1,3 +0,0 @@
-body {
-    background-color: #EEEEEE
-}

+ 0 - 8
ex6-hello/templates/main.html

@@ -1,8 +0,0 @@
-<!DOCTYPE html>
-<head>
-    <title>Hello {{.}}</title>
-    <link rel="stylesheet" type="text/css" href="resource/main.css"/>
-</head>
-<body>
-<h1>Hello {{.}}</h1>
-</body>

+ 0 - 0
ex6-hello/certs/localhost.cert → ex6/certs/localhost.cert


+ 0 - 0
ex6-hello/certs/localhost.key → ex6/certs/localhost.key


+ 6 - 4
ex6-hello/main.go → ex6/main.go

@@ -14,19 +14,21 @@ func main() {
 	t := template.Must(template.ParseFiles("templates/main.html"))
 	s := server{template: t}
 	http.HandleFunc("/", s.handleRoot)
-	http.Handle("/resource/", http.FileServer(http.Dir(".")))
-	log.Fatal(http.ListenAndServeTLS(":8443", "certs/localhost.cert", "certs/localhost.key", nil))
+	http.Handle("/resources/", http.FileServer(http.Dir(".")))
+	log.Println("Listening on https://localhost:8443")
+	err := http.ListenAndServeTLS(":8443", "certs/localhost.cert", "certs/localhost.key", nil)
+	log.Fatal(err)
 }
 
 func (s *server) handleRoot(w http.ResponseWriter, r *http.Request) {
+	w.Header().Set("Content-Type", "text/html")
 
 	if r.RequestURI != "/" {
 		http.NotFound(w, r)
 		return
 	}
 
-	w.Header().Set("Content-Type", "text/html")
-	err := s.template.Execute(w, "Devoxx")
+	err := s.template.Execute(w, "Vrolijk pasen!")
 
 	if err != nil {
 		log.Println(err)

File diff suppressed because it is too large
+ 754 - 0
ex6/resources/img/eggs-in-grass.svg


+ 0 - 0
resources/Rabbit-002-Face-Cartoon-Easter-w-Baby.svg → ex6/resources/img/rabbit.svg


+ 15 - 0
ex6/resources/main.css

@@ -0,0 +1,15 @@
+body {
+    background-color: #92CD00
+}
+
+header img {
+    display: inline;
+    vertical-align: middle;
+    width: 150px;
+}
+
+header h1 {
+    display: inline;
+    vertical-align: middle;
+    color: #2C6700
+}

+ 11 - 0
ex6/templates/main.html

@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<head>
+    <title>{{.}}</title>
+    <link rel="stylesheet" type="text/css" href="resources/main.css"/>
+</head>
+<body>
+<header>
+    <img src="resources/img/rabbit.svg"/>
+    <h1>{{.}}</h1>
+</header>
+</body>

+ 3 - 0
ex7/main.go

@@ -0,0 +1,3 @@
+package main
+
+

Some files were not shown because too many files changed in this diff