Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/flatsheet/datwrapper
https://github.com/flatsheet/datwrapper
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/flatsheet/datwrapper
- Owner: flatsheet
- License: mit
- Created: 2015-07-12T23:10:43.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-19T17:39:37.000Z (about 9 years ago)
- Last Synced: 2024-10-03T17:16:23.007Z (about 1 month ago)
- Language: JavaScript
- Size: 152 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-starred - flatsheet/datwrapper - (others)
README
# datwrapper
Manage a bunch of datasets via JS or API with versioning, dynamic schemas, and that are compatible & replicable with [Dat](http://dat-data.com) instances. Built for use in [flatsheet](http://github.com/flatsheet/flatsheet).
[![Build Status](https://travis-ci.org/flatsheet/datwrapper.svg)](https://travis-ci.org/flatsheet/datwrapper)
## Install
```
npm install --save datwrapper
```## Overview
The datwrapper router provides these routes:
```
GET /data
POST /data
GET /data/:key
PUT /data/:key
DELETE /data/:keyPOST /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/:rowkeyGET /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](LICENSE.md)