golang 中管理仪表板的建议
Suggestions for admin dashboard in golang
我正在使用 gobuffalo framework to create a website with a postgres database, and I am trying to find a good admin dashboard to accompany it. Something like Rail's ActiveAdmin 会很棒。有人有什么建议吗?
我为此使用了模板,效果很好。您可以非常快速地为 CRUD 操作生成具有基本管理视图的视图和潜在的处理程序和模型,这很好。显然,对于每个管理视图,您都希望在某种程度上对其进行自定义,但作为起点,它工作得很好。
This is the tool I'm using (if you've used rails it should be familiar), you should also be able to knock something together with go generate (for code), a tool like genny, or just your own solution using text/template输出你需要的。我现在已经在几个项目中使用了这种方法,如果您发现自己创建了稍后需要自定义的仪表板,我建议您使用这种方法。大多数应用程序的每个资源(创建、更新、删除、索引)都有一定数量的样板文件。
我最终使用了 qor/admin to generate the dashboard. It came with views that were already setup. The only code I needed was to tell qor
which models I wanted to show. For anyone else trying to implement this in gobuffalo.io, here is how you can generate the routes
func App() *buffalo.App {
if app == nil {
app = buffalo.Automatic(buffalo.Options{
Env: ENV,
SessionName: "_liam_session",
})
app.GET("/", HomeHandler)
app.ANY("/admin/{path:.+}", buffalo.WrapHandler(http.StripPrefix("/admin", Other())))
app.ServeFiles("/assets", packr.NewBox("../public/assets"))
}
return app
}
func Other() http.Handler {
f := func(res http.ResponseWriter, req *http.Request) {
fmt.Fprintln(res, req.URL.String())
fmt.Fprintln(res, req.Method)
}
mux := mux.NewRouter()
mux.HandleFunc("/foo", f).Methods("GET")
mux.HandleFunc("/bar", f).Methods("DELETE")
return mux
}
我正在使用 gobuffalo framework to create a website with a postgres database, and I am trying to find a good admin dashboard to accompany it. Something like Rail's ActiveAdmin 会很棒。有人有什么建议吗?
我为此使用了模板,效果很好。您可以非常快速地为 CRUD 操作生成具有基本管理视图的视图和潜在的处理程序和模型,这很好。显然,对于每个管理视图,您都希望在某种程度上对其进行自定义,但作为起点,它工作得很好。
This is the tool I'm using (if you've used rails it should be familiar), you should also be able to knock something together with go generate (for code), a tool like genny, or just your own solution using text/template输出你需要的。我现在已经在几个项目中使用了这种方法,如果您发现自己创建了稍后需要自定义的仪表板,我建议您使用这种方法。大多数应用程序的每个资源(创建、更新、删除、索引)都有一定数量的样板文件。
我最终使用了 qor/admin to generate the dashboard. It came with views that were already setup. The only code I needed was to tell qor
which models I wanted to show. For anyone else trying to implement this in gobuffalo.io, here is how you can generate the routes
func App() *buffalo.App {
if app == nil {
app = buffalo.Automatic(buffalo.Options{
Env: ENV,
SessionName: "_liam_session",
})
app.GET("/", HomeHandler)
app.ANY("/admin/{path:.+}", buffalo.WrapHandler(http.StripPrefix("/admin", Other())))
app.ServeFiles("/assets", packr.NewBox("../public/assets"))
}
return app
}
func Other() http.Handler {
f := func(res http.ResponseWriter, req *http.Request) {
fmt.Fprintln(res, req.URL.String())
fmt.Fprintln(res, req.Method)
}
mux := mux.NewRouter()
mux.HandleFunc("/foo", f).Methods("GET")
mux.HandleFunc("/bar", f).Methods("DELETE")
return mux
}