Example #1
0
func SetupDB() *sql.DB {
	dbConfig, err := utility.LoadPage("article/dbconfig")
	utility.ShitAppend(err)
	DB, err := sql.Open("postgres", string(dbConfig.Body))
	utility.ShitAppend(err)
	return DB
}
Example #2
0
func Handler(rw http.ResponseWriter, req *http.Request) {
	if req.URL.Path != "/" { // Check if the request is for the root
		http.NotFound(rw, req)
		return
	}
	var _, er = req.Cookie("fishme")

	if er != nil {
		temp, err := template.ParseFiles("template/index.html")
		signin, err := utility.LoadPage("article/signin")
		utility.ShitAppend(err)
		SignButton := template.HTML(string(signin.Body))
		temp.Execute(rw, SignButton)
	} else {
		http.Redirect(rw, req, "/home", http.StatusFound)
	}
}