🚀 Project Update:

Lambda API: v0.2.0 released

I’ve been banging away at some features for Lambda API as I discover new use cases in production. This new release adds two new convenience methods: location() and redirect(). These are great for shortcutting redirects without needing to manually specify the headers. I also cleaned up the code a bit and removed some inconsistent whitespace.  👨🏻‍💻🎉

Plus I created a fancy new logo a few days ago! See what I did there? I like it. 🤘🏻

Introducing Namespaces! 🚀

Lambda API now allows you to map specific modules to namespaces that can be accessed from the REQUEST object. This is helpful when using the pattern in which you create a module that exports middleware, error, or route functions.

In the example below, the data namespace is added to the API and then accessed by reference within an included module:

The users.js module might look like this:

By saving references in namespaces, you can access them without needing to require them in every module. Namespaces can be added using the app() method of the API. app() accepts either two parameters: a string representing the name of the namespace and a function reference OR an object with string names as keys and function references as the values.

For example:

I find this feature super useful for passing around data references and utility functions! Let me know what you think.

Release Notes

Feature Release

v0.2.0 of Lambda API adds a few new convenience methods and introduces NAMESPACES, a new feature that lets you pass module references through the REQUEST object. See the documentation for examples.

Features:

  • Add location() and redirect() convenience methods 8b9a746
  • Add namespaces 1a37cd7
  • Add util functions escapeHtml and encodeUrl 72c6380

Documentation and Tests:

  • Add tests for new location() and redirect() methods e5cafd4
  • Add namespace documentation and other minor adjustments 3352c29
  • Update documentation with new methods 2dfdb10, 7e1f6bf
  • Add slow() setting for promise tests 8f1cc3a

Fixes:

Full Release Notes: https://github.com/jeremydaly/lambda-api/releases/tag/v0.2.0


Did you like this post? 👍  Do you want more? 🙌  Follow me on Twitter or check out some of the projects I’m working on. You can sign up for my WEEKLY newsletter too. You'll get links to my new posts (like this one), industry happenings, project updates and much more! 📪

Sign Up for my WEEKLY email newsletter


I respect your privacy and I will NEVER sell, rent or share your email address.

Learn more about Lambda API or check out the other projects I'm working on.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.