aws-lambda-proxy-router
This library provides a simple router when using a lambda triggered by API Gateway lambda proxy events.
Usage
let Router = ; moduleexports { let r = eventcontextcallback; // Use any middleware function you want here r; // Bind a simple route // Returns a promise that resolves if the route matches. // The resolved value is either the event, or the output of your middleware functions. r ; // Helper methods for GET, POST, PUT, DELETE r //... // Can add mappings or 'middleware' to specific routes by just promise chaining r //... // Call r.on404() last. This will be called if no other route matches. r };
Point-Free Syntax
Since the syntax is all promised base, you can chain calls together in a point-free style.
let Router = ; moduleexports { let r = eventcontextcallback; let ; let { //All my async code here //Return a promise that resolves to the customers }; // Point free! r r };