Giter Site home page Giter Site logo

persistencerest's Introduction

##Basic idea

The data stores as Json in Esent (the native windows data sln).

See sample implementation in https://github.com/joeriks/Almhult

(Just run the command line project in Almhult and you get a rest interface on localhost:8080 for any json data.)

###Built in REST-interface

/{resource} : gets all items
/{resource}/{id} : gets one resource item
/{resource} (data) [post] : creates new item
/{resource}/{id} (data) [put] : updates item

####Sample

Shows all items for a specific resource:

/foos 

[{
  "foo": "BC",
  "_date": "2014-02-05T14:55:16.785635+01:00",
  "_id": "1C8F1EA26F7D4225AD4825A536D8D0FD",
  "_rev": 3
},{
  "foo": "AA",
  "_date": "2014-02-05T14:48:07.3833434+01:00",
  "_id": "E8AEC37C3B4A4E0F83A61894C0E495FA"
}]

The resource has two stored items, the "BC" one is the 3rd revision with that id.

Show individual item:

/foos/1C8F1EA26F7D4225AD4825A536D8D0FD

{
  "foo": "BC",
  "_date": "2014-02-05T14:55:16.785635+01:00",
  "_id": "1C8F1EA26F7D4225AD4825A536D8D0FD",
  "_rev": 3
}

Show older revision for individual item:

/foos/1C8F1EA26F7D4225AD4825A536D8D0FD?rev=2

{
  "foo": "B",
  "_date": "2014-02-05T14:46:07.3761702+01:00",
  "_id": "1C8F1EA26F7D4225AD4825A536D8D0FD",
  "_rev": 2
}

###signalr-interface

A SignalR-interface for the data, connect to it from the js console at localhost:8080/index.html

// returns new id
set(object)
set(id, object)

// void
clear()

// returns promise
get(id) 
getValue(id) : gets only value (no id, date and rev info)
get(id, revision)
getAll() : gets all
getAll(true) : gets all, without id, date and rev info

persistencerest's People

Contributors

joeriks avatar

Watchers

 avatar James Cloos avatar

Forkers

codefork

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.