Go File Server
使用 go 内置 http 快速开启文件服务器 func main() { // 方式1 // http.ListenAndServe(":8080", http.FileServer(http.Dir("./public"))) // 方式2: 可自动生成对应文件列表页面 fs := http.FileServer(http.Dir("public")) // http.Handle("/public/", http.StripPrefix("/public/", fs)) // http.Handle("/", http.StripPrefix("/public/", fs)) http.Handle("/", fs) http.ListenAndServe(":8080", nil) }
Recent Posts
Tags
- apache 4
- axios 1
- benchmark 1
- c 1
- canvas 1
- centos 3
- channel 1
- crontab 1
- css 2
- docker 4
- fail2ban 1
- frp 1
- gin 1
- github 1
- go 26
- goaccess 1
- goroutine 1
- http 1
- https 1
- jetbrains 1
- jquery 1
- js 2
- linux 20
- mermaid 1
- mysql 10
- nginx 3
- node 1
- php 43
- prisma 1
- react 8
- server 1
- ssh 2
- tarojs 1
- tcp/ip 1
- token 1
- ubuntu 1
- ufw 1
- unit-test 1
- vmware 1
- vscode 1
- vue 12
- yum 1
- 域名 3
- 安全 2
- 微信 3
- 算法 3