mikedeboer / jsDAV

jsDAV allows you to easily add WebDAV support to a NodeJS application. jsDAV is meant to cover the entire standard, and attempts to allow integration using an easy to understand API.
http://www.mikedeboer.nl
MIT License
681 stars 159 forks source link

Listen to events #115

Closed lavelle closed 10 years ago

lavelle commented 10 years ago

Is there any way to register a callback with JSDAV for the network events? I'd like to run a custom function every time a request is received.

mikedeboer commented 10 years ago

@lavelle You can listen for the beforeMethod event on the handler, but that needs to be done in a plugin, as plugins are also instantiated per HTTP request, along with the handler.

See https://github.com/mikedeboer/jsDAV/blob/master/lib/DAV/plugins/auth.js#L50 for an example.

lavelle commented 10 years ago

Cool that worked thanks for the quick response.