forked from ohayo-jacob/takunomi-blog
added arguments checking
This commit is contained in:
parent
baec822129
commit
80e925baf5
|
@ -4,6 +4,7 @@ import (
|
||||||
"html/template"
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Page struct {
|
type Page struct {
|
||||||
|
@ -18,9 +19,20 @@ var sections = []string {"about","past", "contact"}
|
||||||
var templates = template.Must(template.ParseFiles("blog.tmpl", "blog_roll.tmpl", "style.tmpl", "post.tmpl"))
|
var templates = template.Must(template.ParseFiles("blog.tmpl", "blog_roll.tmpl", "style.tmpl", "post.tmpl"))
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
http.HandleFunc("/", blogHandler)
|
http.HandleFunc("/", blogHandler)
|
||||||
http.HandleFunc("/post/", postHandler)
|
http.HandleFunc("/post/", postHandler)
|
||||||
http.ListenAndServe(":8080", nil)
|
|
||||||
|
if os.Args[1] == "local" {
|
||||||
|
http.ListenAndServe(":8080", nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
if os.Args[1] == "ext" {
|
||||||
|
http.ListenAndServe(":35291", nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
//http.ListenAndServe(":8080", nil)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func blogHandler(w http.ResponseWriter, req *http.Request) {
|
func blogHandler(w http.ResponseWriter, req *http.Request) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user