package main
import (
"fmt"
"html/template"
"log"
"net/http"
"strings"
)
func sayHelloName(w , r *) {
// parse the parameters passed by the url
()
//Print information on the server
()
("path", )
("Scheme", )
(["url_long"])
for k, v := range {
("key:", k)
// The join() method is used to put all elements in the array into a string.
// Elements are separated by specified delimiters
("val:", (v, ""))
}
// Output to client
(w, "hello astaxie!")
}
func login(w , r *) {
("method:", )
if == "GET" {
t, _ := ("")
// Execute the parsing template
// func (t *Template) Execute(wr , data interface{}) error {
(w, nil)
} else {
()
("username:", ["username"])
("password:", ["password"])
}
}
func main() {
//Set access routes
("/", sayHelloName)
("/login", login)
//Set the listening port
err := (":9090", nil)
if err != nil {
("ListenAndserve:", err)
}
}