Snippets

Nicola Paolucci Instant Golang file server

Created by Nicola Paolucci
package main

import (
	"log"
	"net/http"
)

func main() {
	http.Handle("/", http.StripPrefix("/", http.FileServer(http.Dir("."))))
	if err := http.ListenAndServe(":8080", nil); err != nil {
		log.Fatal("ListenAndServe: ", err)
	}
}

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.