Where can I host a project where I can make POST requests

Hello,

As part of building up my list of projects, I’m trying to make a meme generator where I will need to make a POST request to an external API in order to retrieve the final version of the meme in the form of a url for the user to be able save/download it.

As far as I know, Github and other platforms do not allow POST requests as they are static hosts. However I am not sending a POST request to my own code - it’s to a third party API. Is that allowed on these platforms? I’ve tried Googling but no luck.

Grateful for any help :slight_smile:

If it’s just the client making a POST request to an external API I don’t see why it wouldn’t work. Did you test it? That should be the first step.

As long as you are not trying to run a backend on a static host site you should be fine. Calls to external APIs should work.

Github pages does not actually care what your app does. Its the user’s browser that usually cares, usually in the form of a CORS error.

It depends on the API your calling. There are public API’s that will allow you to make requests from the client-side regardless of your origin. If an API is setup for client-side access, you shouldn’t run into these CORS errors. However if the API is not setup for client-side access then not only would you run into CORS errors, you could be leaking your sensitive API token (!)

@lasjorg I tested it now - took me 3-4 hours to do so. And it does work :smile:
Though it took me 3-4 hours to build a simple input field, generate the meme and send it off. Why is code so long!?! :weary:

@bradtaniguchi It’s a public endpoint, anyone can access it even without any API key/tokens. I have dealt with CORS before - very annoying.

Thank you so much for your help :smiley:

Yea one of the first “web development” projects I had to work with was CORS related. Very annoying haha

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.