Skip to content

fossabot/lux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lux

CircleCI GoDoc Go Report Card GitHub license FOSSA Status

An HTTP router for Golang lambda functions

usage

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)
}

About

An HTTP router for Golang lambda functions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages