Skip to content

Global shared

Shared data globally

g.shared is used to share data between post-hooks, pre-hooks, code, and APIs.

  • If the user set a shared variable from the one API response.

    g.shared.outPreApi = g.res.output;
    

  • User can get that shared variables value in another API.

    g.req.body = g.shared.outPreApi;