port number is now an argument
Some checks failed
Build bang-server / Explore-Gitea-Actions (push) Failing after 3s
Some checks failed
Build bang-server / Explore-Gitea-Actions (push) Failing after 3s
implemented actions for auto-building!
This commit is contained in:
8
bang.go
8
bang.go
@@ -5,6 +5,7 @@ import (
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
@@ -329,10 +330,13 @@ func withCORS(handler http.HandlerFunc) http.HandlerFunc {
|
||||
}
|
||||
|
||||
func main() {
|
||||
port := flag.Int("port", 8080, "port to listen on")
|
||||
flag.Parse()
|
||||
|
||||
http.HandleFunc("/users", withCORS(createUserHandler))
|
||||
http.HandleFunc("/email", withCORS(receiveEmailHandler))
|
||||
http.HandleFunc("/mailbox", withCORS(listMailboxHandler))
|
||||
http.HandleFunc("/mailbox/open", withCORS(markEmailOpenedHandler))
|
||||
log.Println("Email server running on :80")
|
||||
log.Fatal(http.ListenAndServe(":80", nil))
|
||||
log.Printf("Email server running on :%d", *port)
|
||||
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", *port), nil))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user