-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathwebforms.go
More file actions
33 lines (29 loc) · 925 Bytes
/
webforms.go
File metadata and controls
33 lines (29 loc) · 925 Bytes
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
//main package has examples shown
// in Hands-On Data Structures and algorithms with Go book
package main
// importing fmt,database/sql, net/http, text/template package
import (
// "fmt"
"net/http"
"text/template"
// "errors"
"log"
)
func Home(writer http.ResponseWriter, reader *http.Request) {
var template_html *template.Template
template_html = template.Must(template.ParseFiles("main.html"))
template_html.Execute(writer, nil)
}
func main() {
log.Println("Server started on: http://localhost:8000")
// var template_html *template.Template
//template_html = template.Must(template.ParseFiles("main.html"))
http.HandleFunc("/", Home)
// http.HandleFunc("/show", Show)
// http.HandleFunc("/new", New)
// http.HandleFunc("/edit", Edit)
// http.HandleFunc("/insert", Insert)
// http.HandleFunc("/update", Update)
// http.HandleFunc("/delete", Delete)
http.ListenAndServe(":8000", nil)
}