Write serverless request handler

Simplifies handling requests from serverless providers while adding error handling and middleware support.