-
Notifications
You must be signed in to change notification settings - Fork 159
Getting Started
Before starting this tutorial, make sure you have completed the Installation steps.
Create an empty project directory. You should make sure this is accessable by your browser.
You can test if installation was succesful by creating a small test.js file containing the following:
var jsDAV_Server = require("jsDAV/lib/DAV/server");
console.log("jsDAV " + jsDAV_Server.VERSION + " is installed.");
Next, create two directories called 'data' and 'public'. We're going to use the 'public' directory to share files through WebDAV, 'data' is for other information. Make sure both folders are writable by the server. Depending on your choice of operating system this could be 'www-data', 'apache', 'httpd' or the 'nobody' user. If you're running a NodeJS server, you're free to take your pick!
If you're not sure how to do this, please consult your system administrator.
Next, we're going to create the server.js file. This is an example of such a file:
var jsDAV = require("jsDAV/lib/jsdav");
// setting debugMode to TRUE outputs a LOT of information to console
//jsDAV.debugMode = true;
var jsDAV_Locks_Backend_FS = require("jsDAV/lib/DAV/plugins/locks/fs");
jsDAV.createServer({
node: __dirname + "/../test/assets",
locksBackend: jsDAV_Locks_Backend_FS.new(__dirname + "/data")
}, 8000);
Now you have your jsDAV installation running. You can open it up in the browser to see if everything went as expected. The following error should be displayed:
<?xml version="1.0"?>
<d:error xmlns:d="DAV:" xmlns:a="http://ajax.org/2005/aml">
<a:exception>jsDAV_Exception_NotImplemented</a:exception>
<a:message>GET is only implemented on File objects</a:message>
<a:file/>
<a:line/>
<a:jsdav-version>0.1.2</a:jsdav-version>
</d:error>
If you see anything else, something went wrong during setup. Now you can connect to the WebDAV server using your client. For more details, check the Client-specific pages:
OS/X Finder
Microsoft Windows Web Folders
DavFS
CyberDuck
BitKinex
Gnome
KDE
NetDrive
OpenOffice/ LibreOffice
Microsoft Office Client
Transmit
Commandline
WebDAV servers can be hard to debug, because the error messages reported by clients are often generic and cryptic. It is highly recommended to use a debugging proxy to find out whats going on over the wire. If your application returns an error, the debugging proxy is the tool to reveal it.
Some tools:
Well, almost.. This WebDAV folder is wide open, everybody can read and write. Implement HTTP authentication to lock it down.
The VirtualFilesystems manual describes how to create your own dav shares.
The TemporaryFileFilter manual describes how to deal with the various temporary
files editors and clients tend to create.
Based on the original document at http://code.google.com/p/sabredav/wiki/GettingStarted