Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
schema
tests
.gitignore
.travis.yml
CONTRIBUTING.md
LICENSE.md
README.md
api-client.js
handler.js
index.js
model.js
package.json
router.js

README.md

datwrapper

Manage a bunch of datasets via JS or API with versioning, dynamic schemas, and that are compatible & replicable with Dat instances. Built for use in flatsheet.

Build Status

Install

npm install --save datwrapper

Overview

The datwrapper router provides these routes:

GET /data
POST /data
GET /data/:key
PUT /data/:key
DELETE /data/:key

POST /data/:key/dat

GET /data/:key/rows
POST /data/:key/rows
GET /data/:key/rows/:rowkey
PUT /data/:key/rows/:rowkey
DELETE /data/:key/rows/:rowkey

GET /data/:key/schema
POST /data/:key/schema
GET /data/:key/schema/:schemakey
POST /data/:key/schema/:schemakey
DELETE /data/:key/schema/:schemakey

Example usage

Create a server to expose the API endpoints:

var createDataServer = require('datwrapper')
var level = require('level')
var http = require('http')

var db = level('db')
var data = createDataServer()
var server = http.createServer(function (req, res) {
  if (data.serve(req, res)) return
  // else serve fallback/error route
})

Require the model to use as a JS library:

var level = require('level')
var dataWrapper = require('datwrapper/model')
var db = level('db')
var data = dataWrapper(db)

License

MIT

You can’t perform that action at this time.