func main() { // db2.AddStore("user") db.AddStore("user") mux := web.NewMux() mux.AddSecureRoutes(ADMIN, admin, adminSaveUser, adminAddUser, adminDeactivate, adminActivate, adminUpdateUserColor, adminUploadUser) mux.AddSecureRoutes(USER, user, updateUser) mux.AddRoutes(root, login, logout, loginPost, pay, home, terms, privacy, serveFiles, uploadError, uploadSuccess, deleteJob) err := http.ListenAndServe(":8888", mux) if err != nil { log.Fatal(err) } }
func main() { mux := web.NewMux("CTIXID", (web.HOUR / 2)) mux.Get("/", root) mux.Get("/login", getLogin) mux.Post("/login", postLogin) mux.Get("/logout", getLogout) mux.Get("/comment", GetComment) mux.Post("/comment", PostComment) DeveloperRoutes(mux) AdminRoutes(mux) CompanyRoutes(mux) mux.Get("/:slug/driver", getDriverHome) mux.Post("/:slug/document/save", saveDocument) mux.Post("/:slug/document/complete", completeDocument) mux.Get("/:slug/document/:id", getDocument) mux.Serve(":8080") }
func main() { mux := web.NewMux("CTIXID", (web.HOUR / 2)) mux.Get("/", root) mux.Get("/login", getLogin) mux.Post("/login", postLogin) mux.Get("/logout", getLogout) AdminRoutes(mux) mux.Get("/:slug", companyLanding) mux.Get("/:slug/login", companyLogin) mux.Post("/:slug/login", postCompanyLogin) mux.Get("/:slug/logout", companyLogout) mux.Get("/:slug/register", companyRegister) mux.Post("/:slug/register", postCompanyRegister) mux.Get("/:slug/driver", getDriverHome) mux.Post("/:slug/document/save", saveDocument) mux.Post("/:slug/document/complete", completeDocument) mux.Get("/:slug/document/:id", getDocument) mux.Serve(":8080") }
package main import ( "fmt" "log" "net/http" "strings" "github.com/cagnosolutions/web" ) var mux *web.Mux = web.NewMux() func main() { mux.Get("/", listOfEndpoints) log.Fatal(http.ListenAndServe(":8080", mux)) } func listOfEndpoints(w http.ResponseWriter, r *http.Request) { ss := make([]string, 0) ss = append(ss, "<h1>Endpoints</h1>") for _, route := range mux.GetRoutes() { ss = append(ss, route.Path) } endpoints := strings.Join(ss, "<br/>") w.Header().Set("Content-Type", "text/html; utf-8") fmt.Fprintf(w, "%s", endpoints) }
"os" "path/filepath" "sort" "strconv" "strings" "github.com/cagnosolutions/dbdb" "github.com/cagnosolutions/web" ) const ( USERNAME = "******" PASSWORD = "******" ) var mux = web.NewMux() var tmpl *web.TmplCache var db = dbdb.NewDataStore() func init() { web.Funcs["split"] = func(s, sep string, i int) string { return strings.Split(s, sep)[i] } web.Funcs["title"] = strings.Title tmpl = web.NewTmplCache() db.AddStore("image") db.AddStore("listing") } func main() {