jmalatras
jmalatras

Reputation: 89

How to write a backend service that runs on a timer?

I'm looking to create a backend application that every morning calls an external API and retrieves certain information, and then saves it to my database. I have subscriptions with both DigitalOcean and AWS so I could use either to host. I am very new to web development/javascript but have years of experience in object oriented languages and can pick it up quickly, I'm just not sure where to start for this. Thanks

Upvotes: 3

Views: 1427

Answers (2)

Rez Moss
Rez Moss

Reputation: 4600

Very straightforward and easy step based on AWS:

1-Create Lambda function for calling your API and retrive data and save to database.At the moment you can create Lambda function with Node.js (JavaScript), Python, and Java (Java 8 compatible).

2-Create a trigger in trigger tab for your lambda function and select CloudWatch Events for the source with one-day duration.

3-Enjoy your serverless function.

for more info read:

Using AWS Lambda with Scheduled Events

Scenario 6: Run an AWS Lambda Function on a Schedule Using the AWS CLI

Schedule Expressions Using Rate or Cron

Upvotes: 1

Gonçalo Velosa
Gonçalo Velosa

Reputation: 54

take a look at laterJs. Works in Node and in the browser.

Upvotes: 0

Related Questions