@@ -24,43 +24,58 @@ npm install
2424
2525## Usage
2626
27- ### Library
27+ The library provides two APIs:
28+
29+ - ` ldnode.createServer(settings) ` : starts a ready to use Express app.
30+ - ` lnode(settings) ` : creates an Express routes that you can mount in your existing express app
31+
32+ In case the ` settings ` is not passed, then it will start with the following default settings.
33+
34+ ``` javascript
35+ {
36+ cache: 0 , // Set cache time (in seconds), 0 for no cache
37+ live: true , // Enable live support through WebSockets
38+ root: ' ./' , // Root location on the filesystem to serve resources
39+ secret: ' node-ldp' , // Express Session secret key
40+ cert: false , // Path to the ssl cert
41+ key: false , // Path to the ssl key
42+ mount: ' /' , // Where to mount Linked Data Platform
43+ webid: false , // Enable WebID+TLS authentication
44+ suffixAcl: ' .acl' , // Suffix for acl files
45+ suffixChanges: ' .changes' , // Suffix for acl files
46+ suffixSSE: ' .events' // Suffix for SSE files
47+ }
48+ ```
49+
50+ ### Examples
51+
2852#### Simple
2953
54+ You can create an ldnode ready to use Express server using ` ldnode.createServer(opts) `
55+
3056``` javascript
3157var ldnode = require (' ldnode' )
3258
3359var ldp = ldnode .createServer ()
34- ldp .listen (1234 , function () {
60+ ldp .listen (3000 , function () {
3561 // Started Linked Data Platform
3662})
3763```
3864
3965#### Advanced
4066
41- You can integrate it with your existing express app
67+ You can integrate it with your existing express app just by using ` lnode(opts) `
4268
4369``` javascript
4470var ldnode = require (' ldnode' )
4571var app = require (' express' )()
46- app .use (' /test' , ldnode ())
72+ app .use (' /test' , ldnode ({ root: ' /path/to/root/container' }))
73+ app .listen (3000 , function () {
74+ // Started Express app with ldp on '/test'
75+ })
4776...
4877```
4978
50- ##### Logging
51-
52- If you are running your own app
53-
54- ``` bash
55- $ DEBUG=" ldnode:*" node app.js
56- ```
57-
58- or simply
59-
60- ``` bash
61- $ ldnode -v
62- ```
63-
6479### Command line tool
6580
6681 npm install -g ldnode
@@ -88,6 +103,20 @@ Options:
88103
89104```
90105
106+ ### Logging
107+
108+ If you are running your own app
109+
110+ ``` bash
111+ $ DEBUG=" ldnode:*" node app.js
112+ ```
113+
114+ or simply
115+
116+ ``` bash
117+ $ ldnode -v
118+ ```
119+
91120## Tests
92121
93122The tests assume that there is a running ldnode.
0 commit comments