Modifying response after route has run?

28 views
Skip to first unread message

Matthias Dietrich

unread,
Jan 21, 2015, 12:41:44 PM1/21/15
to res...@googlegroups.com
Hey there,

for our app I wrote a plugin that adds some additional meta information to the response header. It's only some counters that are being retrieved from the database so the front end can use them. They are added to every response.

Since some requests lead to database changes I'd like to read the values *after* the route has run (after the data behind the counters might have changed).

I checked the docs and source code but couldn't find a way how to do this. There's the "after" event (http://mcavage.me/node-restify/#event-after) with which my plugin could get called, but it seems the response is already on the way to the user at this point.

Is there an API for this or some other hack?

Thanks,
  Matthias
Reply all
Reply to author
Forward
0 new messages