桌面应用安全如何保障?
540
2022-10-18
go-fastweb- Go的MVC框架
go-fastweb 是 Go 语言实现的一个 MVC 框架。
使用案例:
package mainimport ( "fastweb" "os" )type Products struct { fastweb.Controller Name string Brand string Features []string Specifications []string Image string }func (p *Products) View(id string) os.Error { if id == "ah64" { p.Name = "RC Apache AH64 4-Channel Electric Helicoper" p.Brand = "Colco" p.Features = []string{ "4 channel radio control duel propeller system", "Full movement controll: forward, backward, left, right, up and down", "Replica design", "Revolutionary co-axial rotor technology", } p.Specifications = []string{ "Dimensions: L 16 Inches X W 5.5 Inches x H 6.5 Inches", "Battery Duration: 10 min", "Range: 120 Feet", } p.Image = "/img/ah64.jpg" } return nil }func main() { a := fastweb.NewApplication() a.RegisterController(&Products{}) a.Run(":12345") }
and the template of the page body (example/views/products/view.tpl):
{.section Name} Name: {Name}
Manufacturer: {Brand}
{.section Image}
{.end} {.section Features} Features:
Sample Lighttpd Config
$HTTP["host"] =~ "" { server.document-root = "/home/ivan/go-fastweb/example/htdocs/" server.error-handler-404 = "/dispatch.fcgi" fastcgi.server = ( ".fcgi" => ( "localhost" => ( "host" => "127.0.0.1", "port" => 12345, "check-local" => "disable", ))) }
Sample Apache Config
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~