merge tmp to main
This commit is contained in:
41
main.go
41
main.go
@@ -23,9 +23,6 @@ var (
|
||||
//go:embed all:templates/*
|
||||
templateFS embed.FS
|
||||
|
||||
//go:embed css/output.css
|
||||
css embed.FS
|
||||
|
||||
//parsed templates
|
||||
html *template.Template
|
||||
)
|
||||
@@ -49,18 +46,38 @@ func main() {
|
||||
|
||||
//add routes
|
||||
router := http.NewServeMux()
|
||||
// router.Handle("/css/output.css", http.FileServer(http.FS(css)))
|
||||
|
||||
// router.Handle("/company/add", web.Action(companyAdd))
|
||||
// router.Handle("/company/add/", web.Action(companyAdd))
|
||||
itemActions := routes.Items(html)
|
||||
boxActions := routes.Boxes(html)
|
||||
boxItemActions := routes.BoxItems(html)
|
||||
|
||||
|
||||
|
||||
router.Handle("/items/edit", web.Action(itemActions.Edit))
|
||||
router.Handle("/items/delete", web.Action(itemActions.Delete))
|
||||
router.Handle("/items/save", web.Action(itemActions.Save))
|
||||
router.Handle("/items/edit/", web.Action(itemActions.Edit))
|
||||
router.Handle("/items/delete/", web.Action(itemActions.Delete))
|
||||
router.Handle("/items/delete/:id", web.Action(itemActions.Delete))
|
||||
router.Handle("/items/save/", web.Action(itemActions.Save))
|
||||
router.Handle("/items/save/:id", web.Action(itemActions.Save))
|
||||
|
||||
router.Handle("/items/add", web.Action(itemActions.Post))
|
||||
router.Handle("/items/add/", web.Action(itemActions.Post))
|
||||
|
||||
router.Handle("/box-items", web.Action(boxItemActions.Get))
|
||||
router.Handle("/box-items/", web.Action(boxItemActions.Get))
|
||||
router.Handle("/box-items/:id", web.Action(boxItemActions.Get))
|
||||
|
||||
router.Handle("/items", web.Action(itemActions.Get))
|
||||
router.Handle("/boxes", web.Action(boxActions.GetAll))
|
||||
router.Handle("/items/", web.Action(itemActions.Get))
|
||||
router.Handle("/items/:id", web.Action(itemActions.Get))
|
||||
router.Handle("/boxes/", web.Action(boxActions.GetAll))
|
||||
router.Handle("/boxes/:id", web.Action(boxActions.GetAll))
|
||||
|
||||
router.Handle("/", web.Action(routes.HomePage))
|
||||
router.Handle("/items", web.Action(routes.Items(html).GetAll))
|
||||
router.Handle("/items/{id}", web.Action(routes.Items(html).GetByID))
|
||||
router.Handle("/boxes", web.Action(routes.Boxes(html).GetAll))
|
||||
router.Handle("/unrelated", web.Action(func(r *http.Request) *web.Response {
|
||||
return web.HTML(http.StatusOK, html, "row-edit.html", nil, nil)
|
||||
}))
|
||||
router.Handle("/index.html", web.Action(routes.HomePage))
|
||||
|
||||
//logging/tracing
|
||||
nextRequestID := func() string {
|
||||
|
||||
Reference in New Issue
Block a user