Skip to content

Instantly share code, notes, and snippets.

@meoww-bot
Forked from cubarco/simplehttpserver.go
Created April 25, 2023 07:01
Show Gist options
  • Save meoww-bot/317f000bb3a0bab9eedab03b685b5dfe to your computer and use it in GitHub Desktop.
Save meoww-bot/317f000bb3a0bab9eedab03b685b5dfe to your computer and use it in GitHub Desktop.

Revisions

  1. @cubarco cubarco created this gist Dec 3, 2015.
    17 changes: 17 additions & 0 deletions simplehttpserver.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    package main

    import (
    "flag"
    "fmt"
    "net/http"
    )

    func main() {
    var port string
    flag.StringVar(&port, "port", "8000", "the port of http file server")
    flag.Parse()

    fmt.Printf("Serving HTTP on 0.0.0.0 port %s ...\n", port)
    h := http.FileServer(http.Dir("."))
    http.ListenAndServe(":"+port, h)
    }