diff --git a/README.md b/README.md new file mode 100644 index 0000000..d376bf6 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# Serve +For starting http servers on localhost + +## Usage +```bash + serve // this starts a server on port 3000 + + // To use a custom port run + serve -p 5173 +``` + diff --git a/main.go b/main.go index c22cf1d..406d7b9 100644 --- a/main.go +++ b/main.go @@ -3,12 +3,12 @@ package main import ( "flag" "fmt" + "net/http" "os" + "os/signal" "strconv" - "time" "syscall" - "net/http" - "os/signal" + "time" ) func main() { @@ -33,7 +33,7 @@ func main() { for { select { - case rec := <-sig: + case _ = <-sig: signal.Stop(sig) fmt.Println("Gracefully shutting down..") case err := <-errCh: @@ -59,5 +59,5 @@ func serve(port int64, errChan chan error) { errChan <- err return } - fmt.Printf("Server starting on port: %v", port) + fmt.Fprintf(os.Stdout, "Server starting on port: %v", port) } \ No newline at end of file diff --git a/serve b/serve new file mode 100644 index 0000000..efce3da Binary files /dev/null and b/serve differ diff --git a/serve.exe b/serve.exe new file mode 100644 index 0000000..2010c52 Binary files /dev/null and b/serve.exe differ