Skip to content

Commit

Permalink
Added an example to display how to add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienCastex committed Apr 22, 2018
1 parent 9c6d9ae commit 5eafa1a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,29 @@ const server = new webdav.WebDAVServer({
server.start(() => console.log('READY'));
```

With some logs :

```javascript
// TypeScript
import { v2 as webdav } from 'webdav-server'
// JavaScript
const webdav = require('webdav-server').v2;

const server = new webdav.WebDAVServer({
port: 1900
});

server.afterRequest((arg, next) => {
// Display the method, the URI, the returned status code and the returned message
console.log('>>', arg.request.method, arg.uri, '>', arg.response.statusCode, arg.response.statusMessage);
// If available, display the body of the response
console.log(arg.responseBody);
next();
});

server.start(() => console.log('READY'));
```

With a user manager, privilege manager and serialization (save/load the state of the server) :

```javascript
Expand Down

0 comments on commit 5eafa1a

Please sign in to comment.