angular-prerender icon indicating copy to clipboard operation
angular-prerender copied to clipboard

Support request: possible to deploy as cloud function?

Open semla opened this issue 5 years ago • 5 comments

I am looking to deploy a cloud function that can prerender a few urls. I am looking into different ways, but very new to Universal and ssr. Would it be possible to use this library as a cloud function? Thanks,

semla avatar Nov 04 '20 09:11 semla

Hi @semla, I think it depends on your use case.

Do you need that cloud function to prerender a few URLs when deploying your app? In that case the answer is yes. Anything that runs Node.js can be used to run angular-prerender.

Do you want to render some URLs on demand (when a user actually requests on of the URLs) then this sounds more like a use case for Angular Universal with a caching layer to me.

I hope this helps.

chrisguttandin avatar Nov 04 '20 15:11 chrisguttandin

Hi @chrisguttandin, definitely helps. It is more the first use-case, so not in response to requests. I am a bit lost on how to set up angular-prerender as a cloudfunction, any pointers?

semla avatar Nov 05 '20 09:11 semla

I think it's common to use a CI system like Travis, Circle CI, or GitHub Actions for that task. Would that work for your use case?

chrisguttandin avatar Nov 05 '20 11:11 chrisguttandin

Don't think so, I want to render a few urls every half hour or so. So not when deploying, rather when the data fetched has been updated. So not in response to user request either, more like a chron-job. See what I mean? I guess the CI/CD systems use npm to run this library?

semla avatar Nov 05 '20 15:11 semla

Yes, exactly. It would be just another npm script. I'm not sure about other services but GitHub Actions can for example also be triggered like a cron job.

chrisguttandin avatar Nov 05 '20 17:11 chrisguttandin