Skip to content

Commit

Permalink
Updated the read me file
Browse files Browse the repository at this point in the history
  • Loading branch information
gedaiu committed Apr 26, 2015
1 parent e03ed68 commit 16e1379
Showing 1 changed file with 9 additions and 31 deletions.
40 changes: 9 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CardDav no support

Use

void serveFileDav(string rootUrl, string rootPath)(URLRouter router, IDavUserCollection userCollection)
IDav serveFileDav(URLRouter router, string rootUrl, string rootPath);

to bind the fileDav handlers to a vibe router.

Expand All @@ -25,50 +25,28 @@ The next exemple will map every resource from `http://localhost/files` to `publi
...

auto router = new URLRouter;
router.serveFileDav!("/files/", "public/files/")(userConnection);
router.serveFileDav("", "public");

...

listenHTTP(settings, router);

### CalDav

Use the factory class that maps resource types to url nodes:

alias T = FileDavResourceFactory!(
[rootUrl], [rootPath],
Example of maping a simple cal dav folder structure:

[nodeUrl], [collection type], [resource type]
...
);


Example of maping a simple cal dav folder structure (more work will be done here):

auto router = new URLRouter;
auto router = new URLRouter;

// Do some basic auth
router.any("/calendar/*", performBasicAuth("Site Realm", toDelegate(&checkPassword)));

// Create a basic user collection, used to manage CalDav users
auto userConnection = new BaseCalDavUserCollection;

// Create a custom file maping
alias factory = FileDavResourceFactory!(

// map "http://127.0.0.1/calendar" to "public/calendar"
"calendar", "public/calendar",

// map any folder to `FileDavCollection` and file to `FileDavResource`
"", FileDavCollection, FileDavResource,

// map the `personal` folder from users home
// to `FileDavCalendarCollection` and files to `FileDavCalendarResource`
":user/personal", FileDavCalendarCollection, FileDavCalendarResource
);
// Bind the public folder to a vibe router.
auto dav = router.serveFileDav("", "public");

// Bind the custom FileDav maping to a vibe router.
router.serveFileDav!factory(userConnection);
new ACLDavPlugin(dav); // add ACL support to the DAV instance
new CalDavPlugin(dav); // create and bind the CalDav plugin to the DAV instance
new SyncDavPlugin(dav); // create and bind the sync plugin to the DAV instance

...

Expand Down

0 comments on commit 16e1379

Please sign in to comment.