Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Node.js Seneca data storage module that uses JSON files.
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.gitignore
.npmignore
.travis.yml
LICENSE.txt
README.md
jsonfile-store.js version 0.2.2; fixed close call issue
package.json

README.md

seneca-jsonfile-store - a Seneca plugin

seneca-jsonfile-store Plugin

Node.js seneca data storage module that uses JSON files.

This module is a plugin for the Seneca framework. It provides a storage engine that uses JSON files to persist data. It is not appropriate for production usage, it is intended for very low workloads, and as a example of a storage plugin code base.

Build Status

For a gentle introduction to Seneca itself, see the senecajs.org site.

If you're using this plugin module, feel free to contact me on twitter if you have any questions! :) @rjrodger

Current Version: 0.2.2

Tested on: Seneca 0.6.1, Node 0.10.36

Install

npm install seneca
npm install seneca-jsonfile-store

Quick example

var seneca = require('seneca')()
seneca.use('jsonfile-store',{folder:'/path/to/my-db-folder'})

var apple = seneca.make$('fruit')
apple.name  = 'Pink Lady'
apple.price = 0.99
apple.save$(function(err,apple){
  console.log( "apple.id = "+apple.id  )
})

Usage

You don't use this module directly. It provides an underlying data storage engine for the Seneca entity API:

var entity = seneca.make$('typename')
entity.someproperty = "something"
entity.anotherproperty = 100

entity.save$( function(err,entity){ ... } )
entity.load$( {id: ...}, function(err,entity){ ... } )
entity.list$( {property: ...}, function(err,entity){ ... } )
entity.remove$( {id: ...}, function(err,entity){ ... } )

Test

cd test
mocha jsonfile.test.js --seneca.log.print
Something went wrong with that request. Please try again.