aboutsummaryrefslogtreecommitdiff
path: root/cmd/quickserv/main.go
blob: f774c5cd391231f48e047e18daa244dbd91b37b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Command quickserv serves a folder of files over HTTP quickly.
package main

import (
	"flag"
	"log"
	"net/http"

	"within.website/x/internal"
)

var (
	port = flag.String("port", "3000", "port to use")
	dir  = flag.String("dir", ".", "directory to serve")
)

func main() {
	internal.HandleStartup()
	http.Handle("/", http.FileServer(http.Dir(*dir)))
	log.Printf("Serving %s on port %s", *dir, *port)
	http.ListenAndServe(":"+*port, nil)
}