Building a Simple API without Server-Side Tech

Hey folks, I’m scratching my head here. Is it possible to set up a basic API without using any backend stuff?

I’m thinking about making a super simple API that I can put on GitHub or GitLab Pages. The idea is to have it work with just client-side tech like React or Vue. No Node.js, no Express, nothing server-side.

What I want is pretty straightforward:

  • Read a text file with quotes
  • Show the quotes as plain text or JSON
  • Pick a random quote and display it

I’m not looking for fake APIs or JSON servers. I want something I can actually use on my own domain, like myusername.github.io.

Has anyone done something like this before? Any tips or tricks would be awesome. Thanks!

hey there! you could try using a static json file hosted on github pages. Then fetch it with javascript in your react/vue app. for random quotes, do the randomization client-side. It’s not a full api but might work for ur needs. good luck!

While it’s not a traditional API, you can achieve a similar result by using a static JSON file hosted on GitHub Pages. You can create a JSON file that contains all your quotes and deploy it alongside your client-side application. Then, use JavaScript’s Fetch API to retrieve the content and implement logic to select and display a random quote. This approach is lightweight and avoids server-side technology, though its scalability may require caching strategies for larger or frequently updated datasets.