Last Updated: February 25, 2016
· bagwanpankaj

A static file server in Go language

A simple file server in Go. Just compile it and run binaries

package main

import "net/http"

func main() {
    http.Handle("/", http.FileServer(http.Dir("./")))
    error := http.ListenAndServe(":9000", nil)
    if error != nil {

Compile it

go build file_serve.go

It will compile it to machine binaries

Then you can run server in any directory using that binary