No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Cannot retrieve the latest commit at this time.
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
components
docs
lib
test
.gitignore
cli.js
example.js
index.js
package.json
readme.md

readme.md

experimenting with taking the REST server out of dat and making it a standalone module.

changed very little so far aside from updating routes-router and fixing a small related bug where opts.key wasn't available in the route handlers so switched to opts.params.key.

To run:

  • clone this repo
  • cd into repo
  • npm install
  • npm start

To use as a module:

npm i --save sethvincent/dat-server-experiment

(note that this installs from github because this module isn't on npm)

Example usage:

Pass a dat instance:

var Dat = require('dat')
var createDatServer = require('dat-server-experiment')

var dat = Dat('./db', function () {
  var server = createDatServer(dat)
  
  server.listen(3333, function() {
    console.log('Listening at 127.0.0.1:3333')
  })
})

Pass a path to dat that exists on the filesystem:

var createDatServer = require('dat-server-experiment')

var server = createDatServer('./db', function () {
  server.listen(3333, function () {
    console.log('Listening at 127.0.0.1:3333')
  })
})