This may be a basic question, but I'm having some difficulty finding an answer online.

My project is a MERN application that draws from an existing open-source API. This API utilizes a database that I've already integrated with my own, which I plan to make changes to. So, we can't just use the existing hosting the API has and make those calls. For reference, the API is this one: https://github.com/5e-bits/5e-srd-api.

I've forked it, so right now I have the GitHub repository of the API and the GitHub repository of the application in the same organization. Is there any way for me to externally call this API from my existing project, or would that require dedicated web hosting? Should I just put the API files in my existing project? It has a lot of bulk, so I'm a little worried about cluttering and having to redo my project's structure to match the API's.

For a more concrete example: say I wanted to fetch the /classes route in the API repo from my application repo. How would I go about doing so without changing the structure of either?

  • 2
    Your question is a bit confusing, because how things are laid out on GitHub has almost no relevance to how you run them; it's just somewhere to put the source code. It's up to you to run that code somewhere; that could be "dedicated web hosting", but presumably you already have somewhere to run your application, so you can run your modified version of the API there as well. – IMSoP Feb 10 at 12:24

I was getting wrapped up in GitHub for some reason. My solution is to put my application code folder and api code folder adjacent to each other, and in my package.json for my application there will be a script that will start the api server simultaneously.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.