Skip to content

Commit 8873305

Browse files
author
Martin Martinez Rivera
committed
Merge branch 'martinmr-acl-https'
2 parents 8289aad + f16afdd commit 8873305

72 files changed

Lines changed: 986 additions & 495 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Makefile‎

Lines changed: 0 additions & 31 deletions
This file was deleted.

‎README.md‎

Lines changed: 68 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ Linked Data Platform server based on [rdflib.js](https://github.com/linkeddata/r
88

99
## Features
1010

11-
- [x] GET, PUT and PATCH support
11+
- [x] GET, PUT, POST and PATCH support
1212
- [x] Proxy for cross-site data access
1313
- [x] Access control using RDF ACLs
14-
- [x] WebID Authentication
15-
- [x] Real-time live updates (using websokets)
14+
- [x] WebID+TLS Authentication
1615
- [x] Mount as express' router
16+
- [x] Command line tool
17+
- [ ] Real-time live updates (using websokets)
1718

1819

1920
## Install
@@ -22,45 +23,62 @@ Linked Data Platform server based on [rdflib.js](https://github.com/linkeddata/r
2223
npm install
2324
```
2425

26+
Due to the use of the sync-request library to implement the ACl feature, ldnode requires a version of node >= 0.12
27+
2528
## Usage
2629

27-
### Library
30+
The library provides two APIs:
31+
32+
- `ldnode.createServer(settings)`: starts a ready to use Express app.
33+
- `lnode(settings)`: creates an Express routes that you can mount in your existing express app
34+
35+
In case the `settings` is not passed, then it will start with the following default settings.
36+
37+
```javascript
38+
{
39+
cache: 0, // Set cache time (in seconds), 0 for no cache
40+
live: true, // Enable live support through WebSockets
41+
root: './', // Root location on the filesystem to serve resources
42+
secret: 'node-ldp', // Express Session secret key
43+
cert: false, // Path to the ssl cert
44+
key: false, // Path to the ssl key
45+
mount: '/', // Where to mount Linked Data Platform
46+
webid: false, // Enable WebID+TLS authentication
47+
suffixAcl: '.acl', // Suffix for acl files
48+
suffixChanges: '.changes', // Suffix for acl files
49+
suffixSSE: '.events' // Suffix for SSE files
50+
}
51+
```
52+
53+
### Examples
54+
2855
#### Simple
2956

57+
You can create an ldnode ready to use Express server using `ldnode.createServer(opts)`
58+
3059
```javascript
3160
var ldnode = require('ldnode')
3261

3362
var ldp = ldnode.createServer()
34-
ldp.listen(1234, function() {
63+
ldp.listen(3000, function() {
3564
// Started Linked Data Platform
3665
})
3766
```
3867

3968
#### Advanced
4069

41-
You can integrate it with your existing express app
70+
You can integrate it with your existing express app just by using `lnode(opts)`
4271

4372
```javascript
4473
var ldnode = require('ldnode')
4574
var app = require('express')()
46-
app.use('/test', ldnode())
75+
app.use('/test', ldnode({ root:'/path/to/root/container' }))
76+
app.listen(3000, function() {
77+
// Started Express app with ldp on '/test'
78+
})
4779
...
4880
```
4981

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-
6482
### Command line tool
6583

6684
npm install -g ldnode
@@ -74,7 +92,7 @@ Options:
7492
-v, --verbose Print the logs to console
7593
--version Print current ldnode version
7694
-m, --mount Where to mount Linked Data Platform (default: '/')
77-
-b, --base Base location to serve resources
95+
-r, --root Root location on the filesystem to serve resources
7896
-p, --port Port to use
7997
-c, --cache Set cache time (in seconds), 0 for no cache
8098
-K, --key Path to the ssl key
@@ -88,6 +106,28 @@ Options:
88106
89107
```
90108

109+
### Logging
110+
111+
If you are running your own app
112+
113+
```bash
114+
$ DEBUG="ldnode:*" node app.js
115+
```
116+
117+
or simply
118+
119+
```bash
120+
$ ldnode -v
121+
```
122+
123+
### Package scripts
124+
125+
There are some scripts in the [package.json](https://github.com/linkeddata/ldnode/blob/master/package.json):
126+
127+
- `npm start`: starts a very basic ldnode with default configs
128+
- `npm run ldp-webid`: run ldnode with SSL and WebID+TLS enabled (remember it runs in HTTPS)
129+
- `npm run ldp-ssl`: same as the above without WebID+TLS support
130+
91131
## Tests
92132

93133
The tests assume that there is a running ldnode.
@@ -98,6 +138,12 @@ $ npm test
98138
$ DEBUG="ldnode:*" npm test
99139
```
100140

141+
In order to test a single component, you can run
142+
143+
```javascript
144+
npm run test-(acl|formats|params|patch)
145+
```
146+
101147
## License
102148

103149
MIT

0 commit comments

Comments
 (0)