Skip to content

Instantly share code, notes, and snippets.

@yzchen
Created January 9, 2019 20:01
Show Gist options
  • Select an option

  • Save yzchen/2b26dcefca63ac8e0f745ee7a7bf53e7 to your computer and use it in GitHub Desktop.

Select an option

Save yzchen/2b26dcefca63ac8e0f745ee7a7bf53e7 to your computer and use it in GitHub Desktop.
open a file server with golang
package main
import (
"fmt"
"net/http"
)
const PORT = "7777"
func main() {
fmt.Println("Start listening on port " + PORT)
http.Handle("/", http.FileServer(http.Dir("server-data/")))
http.ListenAndServe(":7777", nil)
}
/*
screen -S server-go
go run file-server.go
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment