+ 1
Hosting for API (free)
I am making a few websites that are completely related to open-source. I'm using 1. Github to store files 2. Netlify to host the website As both Github pages and Netlify host static webpages, and I want some server code and some realtime backend data execution, I want some special place where I can store and run my server code (as Netlify builds the website at upload time, and hence, doesn't allow users to have any custom server code). I want to call my API via my webpage and then accept the data returned by the API in some format like JSON. Is there any place which I can use as a server sort of thing for my API? It should be Github compatible, hence for developers and testers.
1 Answer
+ 1
I've used https://www.000webhost.com/ and it is free. That supports PHP, MySQL on the server. The stability is lower than a paid host, though. I had to disable an ad in their control panel so that wouldn't insert some ad-related HTML into every HTTP response too.
I haven't tried this myself but heard Azure offers a lot of services for free up to a very generous quota. This would be much more reliable than 000webhost but will require learning a little more about Azure and their services.
When hosting your API's somewhere different from your HTML files, remember to set the CORS HTTP headers properly in your HTTP responses. You'll run into lots of CORS-related errors until getting that right.
I like that you're separating static and API's like that. I'll do the same on my next web project. It should be the most cost effective way to host a website. If the service that runs custom code has any limits, it is best to offload as much as possible to places like github pages. It'll complicate deployments a bit but that's likely worth it.