Discussion regarding default population of REST

Well for populating you own data without having a lot of query in every call you could just modify the find content-type controller like this:

// PATH: ./src/api/[content-type]/controllers/[content-type].js

"use strict";

 
/**
 *  event controller
 */
 
const { createCoreController } = require("@strapi/strapi").factories;
 
module.exports = createCoreController("api::event.event", ({ strapi }) => ({
    async find(ctx) {
      ctx.query = { ...ctx.query, populate: '*' }
    
      // Calling the default core action
      const { data, meta } = await super.find(ctx);
  
      // some more custom logic
  
      return { data, meta };
    }
}));

Strapi: 4.0.4

1 Like