O'Reilly logo

Serverless Single Page Apps by Ben Rady

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Writing Lambda Functions

To write the function for our new service, we’re simply going to add another function definition to the index.js file. Name this function popularAnswers. Once you deploy this function, you’ll be able to use the new service we’ve created.

Any additional Lambda functions you want to add to this app should be added to this file as well. As those functions grow, you can break out the logic into other modules in the project, included through the standard Node.js module system.[69]

You might wonder why we aren’t creating a new project to host this function. After all, one of the supposed benefits of microservices is that they’re decoupled from each other. Won’t building all of our Lambda functions into a single project create ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required