An HTTP router for Golang lambda functions
func main() {
// Create a router
router := lux.NewRouter()
// Create a custom panic recovery function (optional). This allows you to do things
// in the event one of your handlers panics.
router.Recovery(recoverFunc)
// Configure the logging (optional), anything in stdout or stderr should be
// logged by AWS.
router.Logging(os.Stdout, &logrus.JSONFormatter{})
// Configure your routes for different HTTP methods. You can specify headers that
// the request must contain to use this route.
router.Handler("GET", getFunc).Headers("Content-Type", "application/json")
router.Handler("PUT", putFunc).Headers("Content-Type", "application/json")
router.Handler("POST", postFunc).Headers("Content-Type", "application/json")
router.Handler("DELETE", deleteFunc).Headers("Content-Type", "application/json")
// Start the lambda.
lambda.Start(router.HandleRequest)
}