使用Go快速创建静态服务
来源:互联网 发布:大连育知同创宿舍 编辑:程序博客网 时间:2024/05/16 12:20
在一些文档中,都是静态文件,但使用了ajax等内容,所以需要部署服务,很麻烦,基于GO语言,开发一块静态
package mainimport ("flag" "net/http""fmt""os/exec")var ( port = flag.String("port",":8888","listen port"))func main() {http.Handle("/", http.FileServer(http.Dir("./")))fmt.Printf("http server :127.0.0.1"+*port+"\n")fmt.Printf("change port like this:\n")c := exec.Command("cmd.exe", "/c", "start", "http://127.0.0.1"+*port)if err := c.Run(); err != nil {fmt.Println("Error: ", err)}fmt.Printf("example:sever.exe -port 80\n") http.ListenAndServe(*port, nil)}
由于上传文件失败,后面补上
0 0
- 使用Go快速创建静态服务
- go语言快速入门:使用静态文件(20)
- Uber如何使用go语言创建高效的查询服务
- 使用Node.js快速创建web服务
- Go web 服务简单使用
- 用 Lile 创建 gRPC-go 服务
- .net快速创建windows服务
- C++快速创建Windows服务
- Web服务快速使用
- 静态创建使用Fragment
- Node创建服务并加载静态页面
- 使用GO语言创建一个Web应用
- MySQL Database on Azure - 利用PowerShell快速创建使用数据库服务
- MySQL Database on Azure - 利用PowerShell快速创建使用数据库服务
- axix 快速发布服务(创建service)
- axis2快速发布服务(创建client)
- 【WCF】-快速创建一个WCF服务库
- 使用命令快速调用服务
- 实现PHP的编译执行分离(separatingcompilation and execution)
- angular 封装 Jquery插件时作用域问题
- HDU 1038.Biker's Trip Odometer【单位换算】【水水水】【8月24】
- PHP的单引号和双引号
- POJ 3321 Apple Tree 树状数组
- 使用Go快速创建静态服务
- EBS中odf文件和xdf文件解释
- hdu--5137
- 8月7日 XE8移动开发入门(一) RadStudio XE8开发环境简介(免费培训)
- 开博之说
- UINavigationBar背景颜色
- Cocos2d-x_创建多个滚动层(每层速度不同)
- Check the difficulty of problems POJ 2151
- Linux下的软件安装