Skip to content

Commit b46b9b0

Browse files
author
nicola
committed
Merge branch 'master' of https://github.com/linkeddata/ldnode
2 parents 64be4fb + fbf1d5b commit b46b9b0

1 file changed

Lines changed: 89 additions & 52 deletions

File tree

‎README.md‎

Lines changed: 89 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
Linked Data Platform server based on [rdflib.js](https://github.com/linkeddata/rdflib.js) and [node.js](https://nodejs.org/). This is all you need to run distributed linked data apps on top of the file system.
88

9+
You can run ldnode as a [command-line tool](https://github.com/linkeddata/ldnode/blob/master/README.md#command-line-tool) or as a [library](https://github.com/linkeddata/ldnode/blob/master/README.md#library) for your Nodejs/Express app.
10+
911
## Features
1012

1113
- [x] GET, PUT, POST and PATCH support
@@ -17,18 +19,49 @@ Linked Data Platform server based on [rdflib.js](https://github.com/linkeddata/r
1719
- [x] Real-time live updates (using websokets)
1820

1921

20-
## Install
22+
## Command line tool
23+
24+
npm install -g ldnode
25+
26+
The command line tool has the following options
27+
28+
```
29+
Usage: ldnode [options]
30+
31+
Options:
32+
-v, --verbose Print the logs to console
33+
--version Print current ldnode version
34+
-m, --mount Where to mount Linked Data Platform (default: '/')
35+
-r, --root Root location on the filesystem to serve resources
36+
-p, --port Port to use
37+
-c, --cache Set cache time (in seconds), 0 for no cache
38+
-K, --key Path to the ssl key
39+
-C, --cert Path to the ssl cert
40+
--webid Enable WebID+TLS authentication
41+
-s, --secret HTTP Session secret key (e.g. "your secret phrase")
42+
-P, --proxy Use a proxy on example.tld/proxyPath
43+
--no-live Disable live support through WebSockets
44+
-sA, --suffix-acl Suffix for acl files (default: '.acl')
45+
-sM, --suffix-meta Suffix for metadata files (default: '.meta')
46+
-sC, --suffix-changes Suffix for acl files (default: '.changes')
47+
-sE, --suffix-sse Suffix for SSE files (default: '.events')
48+
49+
```
50+
51+
## Library
52+
53+
### Install
2154

2255
```
2356
npm install
2457
```
2558

26-
## Usage
59+
### Usage
2760

2861
The library provides two APIs:
2962

30-
- `ldnode.createServer(settings)`: starts a ready to use Express app.
31-
- `lnode(settings)`: creates an Express routes that you can mount in your existing express app
63+
- `ldnode.createServer(settings)`: starts a ready to use [Express](http://expressjs.com) app.
64+
- `lnode(settings)`: creates an [Express](http://expressjs.com) that you can mount in your existing express app.
3265

3366
In case the `settings` is not passed, then it will start with the following default settings.
3467

@@ -49,82 +82,46 @@ In case the `settings` is not passed, then it will start with the following defa
4982
}
5083
```
5184

85+
##### Simple
5286

53-
#### Simple
54-
55-
You can create an ldnode ready to use Express server using `ldnode.createServer(opts)`
87+
You can create an ldnode server ready to use using `ldnode.createServer(opts)`
5688

5789
```javascript
5890
var ldnode = require('ldnode')
59-
60-
var ldp = ldnode.createServer()
91+
var ldp = ldnode.createServer({
92+
key: '/path/to/sslKey.pem',
93+
cert: '/path/to/sslCert.pem',
94+
webid: true
95+
})
6196
ldp.listen(3000, function() {
6297
// Started Linked Data Platform
6398
})
6499
```
65100

66-
#### Advanced
101+
##### Advanced
67102

68-
You can integrate it with your existing express app just by using `lnode(opts)`
103+
You can integrate ldnode in your existing express app, by mounting the ldnode app on a specific path using `lnode(opts)`.
69104

70105
```javascript
71106
var ldnode = require('ldnode')
72107
var app = require('express')()
73-
app.use('/test', ldnode({ root:'/path/to/root/container' }))
108+
app.use('/test', ldnode(yourSettings))
74109
app.listen(3000, function() {
75110
// Started Express app with ldp on '/test'
76111
})
77112
...
78113
```
79114

80-
#### Logs
115+
##### Logs
81116

82117
Run your app with the `DEBUG` variable set:
83118

84119
```bash
85120
$ DEBUG="ldnode:*" node app.js
86121
```
87122

88-
## Command line tool
89-
90-
npm install -g ldnode
91-
92-
The command line tool has the following options
93-
94-
```
95-
Usage: ldnode [options]
96-
97-
Options:
98-
-v, --verbose Print the logs to console
99-
--version Print current ldnode version
100-
-m, --mount Where to mount Linked Data Platform (default: '/')
101-
-r, --root Root location on the filesystem to serve resources
102-
-p, --port Port to use
103-
-c, --cache Set cache time (in seconds), 0 for no cache
104-
-K, --key Path to the ssl key
105-
-C, --cert Path to the ssl cert
106-
--webid Enable WebID+TLS authentication
107-
-s, --secret HTTP Session secret key (e.g. "your secret phrase")
108-
--no-live Disable live support through WebSockets
109-
-sA, --suffix-acl Suffix for acl files (default: '.acl')
110-
-sC, --suffix-changes Suffix for acl files (default: '.changes')
111-
-sE, --suffix-sse Suffix for SSE files (default: '.events')
112-
113-
```
114-
115-
116-
## Package scripts
117-
118-
There are some scripts in the [package.json](https://github.com/linkeddata/ldnode/blob/master/package.json):
119-
120-
- `npm start`: starts a very basic ldnode with default configs
121-
- `npm run ldp-webid`: run ldnode with SSL and WebID+TLS enabled (remember it runs in HTTPS)
122-
- `npm run ldp-ssl`: same as the above without WebID+TLS support
123-
124123
## Tests
125124

126-
The tests assume that there is a running ldnode.
127-
128125
```bash
129126
$ npm test
130127
# running the tests with logs
@@ -139,7 +136,47 @@ npm run test-(acl|formats|params|patch)
139136

140137
## Contributing
141138

142-
Do you want to contribute? Sure, have a look at [CONTRIBUTING.md](https://github.com/linkeddata/ldnode/blob/master/CONTRIBUTING.md).
139+
`ldnode` is only possible due to the excellent work of the following contributors:
140+
141+
<table>
142+
<tbody>
143+
<tr>
144+
<th align="left">Tim Berners-Lee</th>
145+
<td><a href="https://github.com/timbl">GitHub/timbl</a></td>
146+
<td><a href="http://twitter.com/timberners_lee">Twitter/@timberners_lee</a></td>
147+
<td><a href="https://www.w3.org/People/Berners-Lee/card#i">webid</a></td>
148+
</tr>
149+
<tr>
150+
<th align="left">Nicola Greco</th>
151+
<td><a href="https://github.com/nicola">GitHub/nicola</a></td>
152+
<td><a href="http://twitter.com/nicola">Twitter/@nicola</a></td>
153+
<td><a href="https://nicola.databox.me/profile/card#me">webid</a></td>
154+
</tr>
155+
<tr>
156+
<th align="left">Martin Martinez Rivera</th>
157+
<td><a href="https://github.com/martinmr">GitHub/martinmr</a></td>
158+
<td></td>
159+
<td></td>
160+
</tr>
161+
<tr>
162+
<th align="left">Andrei Sambra</th>
163+
<td><a href="https://github.com/deiu">GitHub/deiu</a></td>
164+
<td><a href="http://twitter.com/deiu">Twitter/@deiu</a></td>
165+
<td><a href="https://deiu.me/profile#me">webid</a></td>
166+
</tr>
167+
</tbody>
168+
</table>
169+
170+
171+
172+
173+
#### Do you want to contribute?
174+
175+
- [Join us in Gitter](https://gitter.im/linkeddata/chat) to help with development or to hang out with us :)
176+
- [Create a new issue](https://github.com/linkeddata/ldnode/issues/new) to report bugs
177+
- [Fix an issue](https://github.com/linkeddata/ldnode/issues)
178+
179+
Have a look at [CONTRIBUTING.md](https://github.com/linkeddata/ldnode/blob/master/CONTRIBUTING.md).
143180

144181
## License
145182

0 commit comments

Comments
 (0)