Advice on api and json needed please

Hi, I’m approaching this without reading through the forums too much as I want to do the random generator project on my own api. Do I simply just need a json object on a remote server? I have webspace… I’m wondering how to go about it. Does this need some other dependencies to be installed or cdn linked to. I am planning to make my own set of quotes in an updatable database. Along with an image for each and perhaps further down the line some audio of the original speaker saying the quote. I’m wondering how I can do this.

Thanks

That sounds like a cool project. Have you decided if you want the back-end to be static or dynamic, and if it’s dynamic have you decided on a language/stack?

This is on the freeCodeCamp syllabus. The random quote generator. I just want to embellish it and become familiar with the backend element. Dynamic it would be. Ajax I think. It’s just a hypothetical situation where I have set up a database that is updated from the backend and pushes dynamically to the frontend. I’m wondering if I have to create a database which then updates and exports Json…​I’m not sure at all how this is achieved. I’m only mentioning JSON as this was used in the syllabus we’re doing. What’s the best way of doing this? I just have a domain and hosting. I have no idea of the page structure on the server side. I was just going to post a JSON object as a js file on the server. But, you know…​Whatever way will teach me the most. It’s a simple project.

I’m not sure where your level is, but it sounds like you might benefit from just doing the challenge as written, and coming back to this idea once you have progressed through to some of the back-end and database challenges. Those will give you a stronger foundation and some good ideas for how to approach this project.

3 Likes

I saw some quote generators which were based on JSON file hosted on user’s SSD. Correct me if I’m wrong, but in principle you only need correctly set up JSON file, be it on the net or on local drive, and call it in your doc :wink:

1 Like

Yes, that’s what I thought. I was just wondering out of interest how this would be handled for an updating JSON or database file in a real world set up. So for example a daily quote app… How is the data stored, updated and delivered. I’m assuming ajax and a database on the serverside. I just like to know about what I’m doing. All knowledge surrounding the current project becomes useful for the next. I like to make it as real world as possible because once the skeleton framework of the project is in place the enhancements and future cosmetic
additions become a breeze.

Yes, you could have all of your quotes on the server as json files, and fetch them from your app with ajax. Here is a mockup on codepen that fetches a quote from a statically served json file.

Thanks. I’ve been learning some node.js. I intend to host this on heroku as my Web hosting isn’t set up as a virtual server so I’m assuming this is a way round it. In the end I should have a readable and writable API that I can call via an ajax request to then connect my random quote machine to the data it needs. Please tell me if I’m on the right track and this makes sense. I prefer to learn things this way. I know it’s over what’s required but I’ll be learning stuff that will make future understanding better…

Thanks,

Barry.