Skip to content

codeaudit/node-solid-server

Repository files navigation

ldnode

Build Status NPM Version Gitter chat

Linked Data Platform server based on rdflib.js and node.js. This is all you need to run distributed linked data apps on top of the file system.

Features

  • GET, PUT and PATCH support
  • Proxy for cross-site data access
  • Access control using RDF ACLs
  • WebID Authentication
  • Real-time live updates (using websokets)
  • Mount as express' router

Install

npm install

Usage

The library provides two APIs:

  • ldnode.createServer(settings): starts a ready to use Express app.
  • lnode(settings): creates an Express routes that you can mount in your existing express app

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

{
  cache: 0, // Set cache time (in seconds), 0 for no cache
  live: true, // Enable live support through WebSockets
  root: './', // Root location on the filesystem to serve resources
  secret: 'node-ldp', // Express Session secret key
  cert: false, // Path to the ssl cert
  key: false, // Path to the ssl key
  mount: '/', // Where to mount Linked Data Platform
  webid: false, // Enable WebID+TLS authentication
  suffixAcl: '.acl', // Suffix for acl files
  suffixChanges: '.changes', // Suffix for acl files
  suffixSSE: '.events' // Suffix for SSE files
}

Examples

Simple

You can create an ldnode ready to use Express server using ldnode.createServer(opts)

var ldnode = require('ldnode')

var ldp = ldnode.createServer()
ldp.listen(3000, function() {
  // Started Linked Data Platform
})

Advanced

You can integrate it with your existing express app just by using lnode(opts)

var ldnode = require('ldnode')
var app = require('express')()
app.use('/test', ldnode({ root:'/path/to/root/container' }))
app.listen(3000, function() {
  // Started Express app with ldp on '/test'
})
...

Command line tool

npm install -g ldnode

The command line tool has the following options

Usage: ldnode [options]

Options:
   -v, --verbose           Print the logs to console
   --version               Print current ldnode version
   -m, --mount             Where to mount Linked Data Platform (default: '/')
   -r, --root              Root location on the filesystem to serve resources
   -p, --port              Port to use
   -c, --cache             Set cache time (in seconds), 0 for no cache
   -K, --key               Path to the ssl key
   -C, --cert              Path to the ssl cert
   --webid                 Enable WebID+TLS authentication
   -s, --secret            HTTP Session secret key (e.g. "your secret phrase")
   --no-live               Disable live support through WebSockets
   -sA, --suffix-acl       Suffix for acl files (default: '.acl')
   -sC, --suffix-changes   Suffix for acl files (default: '.changes')
   -sE, --suffix-sse       Suffix for SSE files (default: '.events')

Logging

If you are running your own app

$ DEBUG="ldnode:*" node app.js

or simply

$ ldnode -v

Tests

The tests assume that there is a running ldnode.

$ npm test
# running the tests with logs
$ DEBUG="ldnode:*" npm test

License

MIT

About

Solid server on top of the file-system in NodeJS

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 93.1%
  • HTML 5.8%
  • Other 1.1%