-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the 'loadPhysicalFolder' example
- Loading branch information
1 parent
595bcf1
commit 7ed6c7a
Showing
8 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Custom Web Resource | ||
|
||
This is an example to show how to load a physical folder. | ||
|
||
## Usage | ||
|
||
### Execute | ||
|
||
```bash | ||
node index.js | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Hello friends! | ||
|
||
Is it ok? |
Empty file.
Empty file.
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const webdav = require('webdav-server'); | ||
|
||
webdav.PhysicalFolder.loadFromPath('./data', (e, folder) => { | ||
if(e) throw e; | ||
|
||
const server = new webdav.WebDAVServer({ | ||
port: 1900 | ||
}); | ||
|
||
server.addResourceTree(folder, (e) => { | ||
if(e) throw e; | ||
|
||
server.start((s) => { | ||
console.log('Server started on port ' + s.address().port + '.'); | ||
}); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { PhysicalFolder, WebDAVServer } from 'webdav-server' | ||
|
||
PhysicalFolder.loadFromPath('./data', (e, folder) => { | ||
if(e) throw e; | ||
|
||
const server = new WebDAVServer({ | ||
port: 1900 | ||
}); | ||
|
||
server.addResourceTree(folder, (e) => { | ||
if(e) throw e; | ||
|
||
server.start((s) => { | ||
console.log('Server started on port ' + s.address().port + '.'); | ||
}); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "loadphysicalfolder", | ||
"version": "1.0.0", | ||
"description": "Example to show how to load a physical folder.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "node test.js" | ||
}, | ||
"author": "Adrien Castex <[email protected]>", | ||
"license": "Unlicense", | ||
"dependencies": { | ||
"webdav-server": "^1.8.2" | ||
} | ||
} |