1. 程式人生 > >Go語言實現簡單的檔案伺服器

Go語言實現簡單的檔案伺服器

package main

import (
	"fmt"
	"net/http"
)

func main() {
	http.Handle("/", http.FileServer(http.Dir("./")))
	e := http.ListenAndServe(":8080", nil)
	fmt.Println(e)
}