Use the database queries in the service component

We replace the local storage with persistent storage using the MongoDB database.

Inside the service.go in the service directory, we create a constant to store the collection name for blog data.

const BLOG_COLLECTION = "blogs"

Get all blogs

We modify the GetAllBlogs() function to get all blog data from the database.

Get hands-on with 1200+ tech skills courses.