I am using Strapi V4, and I have created a middleware that allows returning the ‘createdBy’ field:
javascript
Copier le code
module.exports = (config, { strapi }) => {
return async (ctx, next) => {
if (!ctx.query.populate) {
ctx.query.populate = ["createdBy"];
}
await next();
};
};```
It works well; however, when I create an element via a POST request, the 'createdBy' value is set to 'null'.
<i>This topic has been created from a Discord post (1281629561515282463) to give it more visibility.
It will be on Read-Only mode here.
<a href="https://discord.com/channels/811989166782021633/1281629561515282463/1281629561515282463">Join the conversation on Discord</a></i>