This is a creation in Article, where the information may have evolved or changed.
Package Mainimport ("Io/ioutil" "Log" "net/http" "OS")varZpathstring="d:/download/jquery Ligerui v1.3.2/source/" //Ligerui Installation PathvarZportstring=" the"varZsource_file ="Source.config"varZport_file ="Port.config"varStatichandler http. Handlerfunc Init () {ifsourceexist (zport_file) {log. Println ("Port file is"+zport_file) Ztemp_port:=filetostr (zport_file)ifZtemp_port! =""{Zport=Ztemp_port}} Else{log. Println ("port file not exist, please set server port in file"+zport_file) log. Println ("Server would use default port") } ifsourceexist (zsource_file) {log. Println ("Config file is"+zsource_file) Ztemp_path:=filetostr (zsource_file)ifZtemp_path! =""{Zpath=Ztemp_path}} Else{log. Println ("source file not exist, please set Ligerui source path in file"+zsource_file) log. Println ("Server would use default Ligerui path")} Statichandler=http. Fileserver (http. Dir (Zpath))}func indexpage (w http. Responsewriter, req*http. Request) {log. Println (req. Url. Path)ifReq. Url. Path! ="/"{statichandler.servehttp (W, req)return } //processing the home page 127.0.0.1Req. Url. Path ="/index.htm"Statichandler.servehttp (W, req)}func main () {Init () log. Println ("Ligerui Source Path:") log. Println (Zpath) Zport_str:="" ifZport! =" the"{zport_str=":"+Zport} log. Println ("Start Ligerui Server"+"127.0.0.1"+zport_str) http. Handlefunc ("/", Indexpage) Err:= http. Listenandserve (":"+Zport, nil)ifErr! =Nil {log. Fatal ("Listenandserve:", Err)}} Func sourceexist (filenamestring)BOOL{_, Err:=OS. Stat (filename)returnErr = = Nil | |OS. Isexist (Err)}func filetostr (Zfilenamestring)string{zbyte, err:=Ioutil. ReadFile (zfilename) Zstr:="" ifErr = =Nil {zstr=string(zbyte)}returnZstr}