Home > Net >  I have a simple function that runs once a day in node, where should I host it?
I have a simple function that runs once a day in node, where should I host it?

Time:02-04

I have a simple node project with a cron job that runs once a day, inside there is just a post request to the twitter api. I want to run this somewhere 24/7 (or else it defeats the purpose (I want everything to be automated)), I think cloud is the right term, as in not on my computer. I tried Heroku, but since it sleeps once in a while there's no point, same with repl, even with keep awake scripts/work arounds. I can obviously pay somewhere 7 euro a month but what's 7 euros to run a function 31 times, too expensive. I don't want an api or a server of any kind so maybe I'm looking at the wrong direction, I was thinking maybe something server-less, but I'm not sure what that means. Where should I host my node project?

Please Help.

CodePudding user response:

You should Consider using aws lambda. Here's the documentation Link https://docs.aws.amazon.com/lambda/latest/dg/welcome.html

CodePudding user response:

Have you thought about using AWS Lambda Functions. These can be written in node.js and can be scheduled using cron jobs: https://docs.aws.amazon.com/lambda/latest/dg/services-cloudwatchevents-expressions.html The pricing is also very cheap, being about 0.20$ per 1 million requests. https://aws.amazon.com/lambda/pricing/

CodePudding user response:

If you want a simple server to run your functions, you can buy a RaspberryPI. The cheapest option would be a RPIZero that costs around 5$ and another option would be the RaspberryPi 3B costing around 35$. The ups with using these are you can stop the server and continue it at anytime, and put as many scripts as you want, given it can all fit in a micro SD Card.

  •  Tags:  
  • Related