File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# commit0-deployable-backend
2- A commit0 module containing a backend that can be deployed to the infrastructure set up using commit0-aws-eks-stack
2+ A commit0 module containing a backend that can be deployed to the infrastructure set up using commit0-aws-eks-stack.
3+
4+ After rendering the template with the ` zero ` tool, check it into github and run ` go mod init github.com/<path on github> `
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ import (
1212 "strconv"
1313 "syscall"
1414 "time"
15+
16+ "github.com/rs/cors"
1517)
1618
1719const gracefulShutdownTimeout = 10 * time .Second
@@ -37,8 +39,11 @@ func main() {
3739 fmt .Fprintf (w , "Hello, %q" , html .EscapeString (r .URL .Path ))
3840 })
3941
42+ // Change this to a more strict CORS policy
43+ handler := cors .Default ().Handler (r )
44+
4045 serverAddress := fmt .Sprintf ("0.0.0.0:%s" , os .Getenv ("SERVER_PORT" ))
41- server := & http.Server {Addr : serverAddress , Handler : r }
46+ server := & http.Server {Addr : serverAddress , Handler : handler }
4247
4348 // Watch for signals to handle graceful shutdown
4449 stop := make (chan os.Signal , 1 )
You can’t perform that action at this time.
0 commit comments