Golang简单文件服务器,20行代码开启一个http文件服务器,分享运行目录文件

package main

import (
  "fmt"

  "net/http"
)

func main() {

  http.Handle("/", http.FileServer(http.Dir("./")))

  e := http.ListenAndServe(":8080", nil)

  fmt.Println(e)

}

 

作者 admin

发表评论

您的电子邮箱地址不会被公开。