Created
June 24, 2022 08:05
-
-
Save samson-sham/024f2e9259e064b4d359082ed39ab56a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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.requested.uri, '>', arg.response.statusCode, arg.response.statusMessage); | |
// If available, display the body of the response | |
// console.log(arg.responseBody); | |
next(); | |
}); | |
server.setFileSystemAsync('/', new webdav.PhysicalFileSystem(process.cwd())) | |
.then(() => server.start(s => console.log(`READY ${s.address().address}:${s.address().port}`))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment