commit
4248f4d95f
|
@ -4,7 +4,10 @@ const User = require("../models/User");
|
||||||
|
|
||||||
module.exports.getAllBlogs = async (req, res, next) => {
|
module.exports.getAllBlogs = async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
let blog = await Blog.find();
|
let blog = await Blog.find().populate(
|
||||||
|
"author",
|
||||||
|
"-passwordResetToken -password"
|
||||||
|
);
|
||||||
if (blog) {
|
if (blog) {
|
||||||
res.json({ blogs: blog });
|
res.json({ blogs: blog });
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue