Skip to content

Commit

Permalink
Update Doc Service API middleware example (#2368)
Browse files Browse the repository at this point in the history
Added a line to the example code to better clarify how to mutate results in middleware before returning them (or passing them to other middleware down the chain).
  • Loading branch information
Gkleinereva authored Jan 23, 2025
1 parent 7541bff commit 3124d0f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docusaurus/docs/dev-docs/api/document-service/middlewares.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,10 @@ strapi.documents.use(async (context, next) => {

const result = await next();

// do something with the result before returning it
return result
// Modify the result as necessary before returning it
result.retrievedAt = Date.now();

return result;
});
```

Expand Down

0 comments on commit 3124d0f

Please sign in to comment.