Inside View To AngularJS and Lambdas

Ivano Vingiani
minute read.
Share this article

As a result of an investigation on Node and Serverless application I have created a POC using AngularJS and AWS lambdas.

A simple AngularJs app

The first step was to create an Angular app that invokes Eventful API to display a list of events.

Executing the command

The result of the REST call is stored in the weather variable when theapp is loaded.

Then a simple loop prints the list of events

Welcome to {{ title }}!


• Wind speed: {{ event.wind.speed }}

Temperature: {{ event.main.temp }}

Sky: {{ event.weather[0].main }}

Obviously, the layout can be improved but it was out of scope for thisPOC.

AWS Lambda integration

Once I got the app running, I tried to replace the Eventuful API with AWS Lambdas.

From the AWS console, I’ve created a new NodeJs Lambda function with basic permissions

Then I’ve edited index.js with the code to fetch the events. One thingto remember when creating a REST API with lambda, is that it expects the outputto have a specific format. Sending back just the JSON response received fromEventful would generate an exception.

In order to expose our Lambda function to the world, we’ll need to setup an API Gateway. This is simple enough and requires very few steps.
From the function’s management page, it’s sufficient to click on the APIGateway trigger and choose “Create a new API”:

For the purpose of this project we’ll stick with “Open” security, but other options are available.

Once the trigger is created AWS will assign and endpoint to the function:

The final step is to edit the Angular app and replace the URL of the Eventful API with the URL the lambda function:


For such a simple POC, and when an external REST API already exists to provide the required service, the use of Lambdas may seem a bit overkill.

However, it allows to remove part of the code (and its configuration) from the main application, keeping it simple and light.

Most importantly, it allows us to leverage the cloud’s scaling capabilities for more heavy-weight operations.

Amido needs the contact information you provide to us to contact you about our products and services. You may unsubscribe from these communications at any time. For information  please review our privacy policy.
Oops! Something went wrong while submitting the form.

Things you will learn

No items found.

Related content

No items found.

Need help plotting a route to the cloud?

We can help you define your digital strategy and turn it into a technical roadmap, achieving momentum to quickly deliver business value, whilst minimising risk.

Ask a question

If you consent to receiving communications from Amido, please subscribe using the checkbox below. If at any point you'd like to unsubscribe, you can do so using the links provided in our newsletters. You can review how your data is handled in our privacy policy.
Thank you, your submission has been received!
Oops! Something went wrong while submitting the form.