enhancedfileserver/example/main.go

20 lines
377 B
Go
Raw Normal View History

2018-08-24 13:01:44 +00:00
package main
import (
2018-08-24 13:05:37 +00:00
"gitto.work/shortcut/enhancedfileserver"
2018-08-24 13:07:20 +00:00
"log"
2018-08-24 13:01:44 +00:00
"net/http"
"os"
)
/* Most simple example of using enhanced-file-server package. Will serve from the current directory on port 12345 */
func main() {
dir, err := os.Getwd()
2018-08-24 13:10:48 +00:00
if err != nil {
log.Fatal(err)
}
2018-08-24 13:01:44 +00:00
2018-09-02 22:05:46 +00:00
log.Fatal(http.ListenAndServe(":12345", enhancedfileserver.FileServer(http.Dir(dir))))
2018-08-24 13:01:44 +00:00
}