Pardon our mess! We are busy building up docs for our beta users.

Contact us if you need any help getting started, or have any questions at [email protected]

HTTP

Serverless applications are the fastest way to build a reliable HTTP server. With a few lines of configuration, you can build your own scalable HTTP server.

Overview

HTTP is a natural fit as it is based on stateless request/response patterns. To build an HTTP server, you must first write the corresponding handler functions. Our shim library makes it easy to integrate HTTP handlers into AWS Lambda.

Config

The http configuration map is an object, where the map key is the absolute url for the endpoint, and the map value object defines its configuration.

Example:

http:
	/:
		get:
			function: my_index_function
	/rest/widgets:
		get:
			function: get_widgets_function
	/rest/widget/{id}:
		get:
			function: get_widget_function
		put:
			function: create_widget_function
		post:
			function: update_widget_function
		delete:
			function: delete_widget_function

As you can see, HTTP handlers are grouped by the URI path, followed by the HTTP method. The allowed HTTP methods are:

  • get
  • put
  • post
  • delete
  • options
  • head
  • patch

Function

The function parameter specifies the function which should be called when a request is received. This function must be defined in the functions config section.

Our shim library allows you to build HTTP handlers using your favorite Node.js HTTP server library. Express, Koa, Hapi, and Restify are all supported and make converting your existing codebase to serverless a breeze.