-
Notifications
You must be signed in to change notification settings - Fork 86
/
tpl.go
46 lines (45 loc) · 936 Bytes
/
tpl.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
var tpl = []byte(`<!DOCTYPE html>
<html>
<head>
<title>Golang-Mongo-Sample</title>
</head>
<body>
<h1 align="center">It work</h1>
<hr />
<table border="1" align="center" width="50%">
<caption>Contact List</caption>
<thead>
<tr>
<th bgColor=#e5ecf9>Name</th>
<th bgColor=#e5ecf9>Phone</th>
</tr>
</thead>
<tbody>
{{with .List}}
{{range .}}
<tr>
<th>{{.Name}}</th>
<th>{{.Phone}}</th>
</tr>
{{end}}
{{end}}
</tbody>
</table>
<br />
<form method="post" action="/new">
<fieldset>
<legend>New contact</legend>
<label for="name">Name: </label>
<input id="name" type="text" name="name" required/>
<label for="phone">Phone: </label>
<input id="phone" type="text" name="phone" required/>
<input type="submit" />
</fieldset>
</form>
<br />
<form method="post" action="/drop">
<input type="submit" value="clear all contact" />
</form>
</body>
</html>`)