Browse Source

fasthttp: use one template file instead of two for fortune benchmark

Aliaksandr Valialkin 9 years ago
parent
commit
eb8e685ab3

+ 1 - 1
frameworks/Go/fasthttp-mysql/src/hello/hello.go

@@ -47,7 +47,7 @@ var (
 const helloWorldString = "Hello, World!"
 
 var (
-	tmpl = template.Must(template.ParseFiles("templates/layout.html", "templates/fortune.html"))
+	tmpl = template.Must(template.ParseFiles("templates/fortune.html"))
 
 	db *sql.DB
 

+ 10 - 10
frameworks/Go/fasthttp-mysql/templates/fortune.html

@@ -1,14 +1,14 @@
-{{define "content"}}
+<!DOCTYPE html>
+<html>
+<head>
+<title>Fortunes</title>
+</head>
+<body>
 <table>
-<tr>
-<th>id</th>
-<th>message</th>
-</tr>
+<tr><th>id</th><th>message</th></tr>
 {{range .}}
-<tr>
-<td>{{.Id}}</td>
-<td>{{.Message}}</td>
-</tr>
+<tr><td>{{.Id}}</td><td>{{.Message}}</td></tr>
 {{end}}
 </table>
-{{end}}
+</body>
+</html>

+ 0 - 9
frameworks/Go/fasthttp-mysql/templates/layout.html

@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<title>Fortunes</title>
-</head>
-<body>
-{{template "content" .}}
-</body>
-</html>

+ 1 - 1
frameworks/Go/fasthttp-postgresql/src/hello/hello.go

@@ -46,7 +46,7 @@ var (
 const helloWorldString = "Hello, World!"
 
 var (
-	tmpl = template.Must(template.ParseFiles("templates/layout.html", "templates/fortune.html"))
+	tmpl = template.Must(template.ParseFiles("templates/fortune.html"))
 
 	db *pgx.ConnPool
 

+ 10 - 10
frameworks/Go/fasthttp-postgresql/templates/fortune.html

@@ -1,14 +1,14 @@
-{{define "content"}}
+<!DOCTYPE html>
+<html>
+<head>
+<title>Fortunes</title>
+</head>
+<body>
 <table>
-<tr>
-<th>id</th>
-<th>message</th>
-</tr>
+<tr><th>id</th><th>message</th></tr>
 {{range .}}
-<tr>
-<td>{{.Id}}</td>
-<td>{{.Message}}</td>
-</tr>
+<tr><td>{{.Id}}</td><td>{{.Message}}</td></tr>
 {{end}}
 </table>
-{{end}}
+</body>
+</html>

+ 0 - 9
frameworks/Go/fasthttp-postgresql/templates/layout.html

@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<title>Fortunes</title>
-</head>
-<body>
-{{template "content" .}}
-</body>
-</html>