Initial Commit
This commit is contained in:
parent
7994d145f2
commit
c01a1e2cbd
27
main.go
Normal file
27
main.go
Normal file
@ -0,0 +1,27 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
args := os.Args[1:]
|
||||
port := "8080"
|
||||
if len(args) == 0 {
|
||||
log.Println("Usage: quickhttp <content-dir> [port]")
|
||||
os.Exit(1)
|
||||
}
|
||||
content_dir := args[0]
|
||||
|
||||
if len(args) == 2 {
|
||||
port = args[1]
|
||||
}
|
||||
|
||||
// Public Views
|
||||
fs := http.FileServer(http.Dir(content_dir))
|
||||
http.Handle("/", fs)
|
||||
log.Println("Listening...")
|
||||
log.Fatal(http.ListenAndServe(":"+port, nil))
|
||||
}
|
Loading…
Reference in New Issue
Block a user