Hello everyone. I recently finished the API’s and Microservices course. I am now used to inserting data into a database with mongodb and mongoose using Schemas and models. However, I was wondering how can I retrieve data from the database and pass them as html elements, for example take a user’s message and display it as an html paragraph. Any help will be much appreciated!
You have to interact with the api from the browser as a client, you have basically 3 ways to do this, XMLHttpRequest
(XHR), using the Fetch API, or 3rd party tools like axios.
The Fetch API is the most convenient as it is natively available, imo.
I can’t be completely sure, but I think he might be confused about how to handle this on the server side using post and get methods, for example.
Ah, server side rendering ? then I misunderstood…
Maybe you were right. Hopefully, the OP can clarify.
easies way is to use a template engine like pug _ with express