File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -36,21 +36,21 @@ func ParseRequestBody(r *http.Request, v interface{}) error {
36
36
}
37
37
38
38
func ServeFunction (url string , handler func (http.ResponseWriter , * http.Request )) {
39
- port := flag .Int ("port" , - 1 , "specify a port to use http rather than AWS Lambda " )
39
+ port := flag .Int ("port" , - 1 , "specify a port" )
40
40
flag .Parse ()
41
41
listener := gateway .ListenAndServe
42
- portStr := "n/a "
42
+ addr := ""
43
43
if * port != - 1 {
44
44
err := godotenv .Load ()
45
45
if err != nil {
46
46
log .Print ("Failed to load .env file" )
47
47
}
48
- portStr = fmt .Sprintf (":%d" , * port )
48
+ addr = fmt .Sprintf (":%d" , * port )
49
49
listener = http .ListenAndServe
50
50
http .Handle ("/" , http .FileServer (http .Dir ("./public" )))
51
51
}
52
52
http .HandleFunc (url , handler )
53
53
54
- log .Printf ("Function `%s` running on port %s..." , url , portStr )
55
- log .Fatal (listener (portStr , nil ))
54
+ log .Printf ("Function `%s` running on %s..." , url , addr )
55
+ log .Fatal (listener (addr , nil ))
56
56
}
You can’t perform that action at this time.
0 commit comments