-
Does postgREST support request middleware? Basically, I would like to be able to take some action(s) for incoming requests, e.g. log requests to a special table, log the request body for query optimization (graphql), intercept requests and yield pre-calculated responses (caching), verify request parameters, etc.. I'm using hosted postgREST, meaning I do not have direct access to the host and logs; SQL only. Implementation suggestions In case this is not supported, I was thinking that maybe a workflow like this could work:
While this does cause some overhead and may not be practical for read-only replicas, it would be a great help for people using managed postgREST, e.g. via Supabase. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes, postgREST supports request interception:
Note that GET requests cause the database to be opened in a read only state, meaning it is not possible to perform writes (such as logging to a table) during such requests from this hook. I find this solution to have some flaws:
|
Beta Was this translation helpful? Give feedback.
Yes, postgREST supports request interception:
Note that GET requests cause the database to be opened in a read only state, meaning it is not possible to perform writes (such as logging to a table) during such requests from this hook.
I find this solution to have some flaws: