Giter Club home page Giter Club logo

repono's Introduction

manifesto icon Repono

Repono is a RESTful API for creating and editing IIIF Presentation Manifests. It is a simple datastore that can be used for test data (and potentially more). Since client-side "testing" is one of the use cases, Repono must be able to store invalid manifests that clients respond to. Therefore no validation is performed and is left up to the clients.

Note: If a manifest contains an @id property, the server will use the post-prefix id string as MongoDB's internal _id value. Otherwise, one will be generated.

##Brief instructions:

$ git clone https://github.com/sdellis/repono.git
$ cd repono
$ npm install
$ npm start

##Tests Running tests will create a "manifests" collection, which is needed for the server to work. To run tests, in a new terminal window:

$ mocha express.test.js

Or, if you don't have mocha installed globally:

$ ./node_modules/mocha/bin/mocha express.test.js

##Use Your DB You can add your own db to the app by editing the 'test' part in the following line in express.js:

var db = mongoskin.db('mongodb://@localhost:27017/YourDBName', {safe:true})

##Add Manifests Go to localhost:3000 and start doing CRUD to manifests.

You can also use CURL to do CRUD to your own collections and manifests.

$ curl -H "Content-Type: application/json" -X GET http://localhost:3000/collections/manifests/
$ curl -H "Content-Type: application/json" -X GET http://localhost:3000/collections/manifests/:id
$ curl -H "Content-Type: application/json" -X DELETE http://localhost:3000/collections/manifests/:id
$ curl -H "Content-Type: application/json" -X PUT -d '{"label":"Thus Spoke Zarathustra"}' http://localhost:3000/collections/manifests/:id
$ curl -H "Content-Type: application/json" -X POST -d '{"label":"Thus Spoke Zarathustra"}' http://localhost:3000/collections/manifests/

You can also create your own collections by simply posting to a new collection name (soon to be integrated with the web interface):

$ curl -H "Content-Type: application/json" -X POST -d '{"label":"Thus Spoke Zarathustra"}' http://localhost:3000/collections/MyNewCollection

Attribution: This work is based on Azat Mardan's REST-API-EXPRESS repository for Express 4.

repono's People

Contributors

sdellis avatar

Stargazers

 avatar Nicolas Mermoud-Ghraichy avatar Kate Lynch avatar Jeremy Tubbs avatar Régis Robineau avatar María A. Matienzo avatar

Watchers

 avatar James Cloos avatar

repono's Issues

Create a "manifesto" repository in the IIIF organisation that handles the "live" object, keep current "manifesto" as the server.

I would like to get started on the bare "implementation of spec with getters and setters" version of "manifesto". Since this repository is an express server with REST methods for dealing with manifests, I have tentatively called the IIIF repo "manifesto-client", but would like to change the name to "manifesto".

Keeping the server/REST interface separate from the model implementation seems advantageous. Ideas, comments?

MongoSkin is Broken

Look into using Mongoose.

Mongoskin 1.4.4 cannot do a remote authentication with MongoLabs.
Mongoskin 2.0.3 crashes app on PUT requests

Some nested data gets "flattened" by MongoDB

There is a strange "flattening" of data. Not sure if this is a MongoDB thing or not, but here is a sample:

Input via POST request:

{
  "images": [
    {
      "resource": {
        "service": {
          "profile": "http:\/\/library.stanford.edu\/iiif\/image-api\/1.1\/conformance.html#level1",
          "@id": "http:\/\/ids.lib.harvard.edu\/ids\/iiif\/48530377"
        },
        "format": "image\/jpeg",
        "height": 109517,
        "width": 6251,
        "@id": "http:\/\/ids.lib.harvard.edu\/ids\/iiif\/48530377\/full\/full\/full\/native",
        "@type": "dcterms:Image"
      },
      "on": "http:\/\/oculus-dev.harvardx.harvard.edu\/manifests\/drs:48309543\/canvas\/canvas-48530377.json",
      "motivation": "sc:painting",
      "@id": "http:\/\/oculus-dev.harvardx.harvard.edu\/manifests\/drs:48309543\/annotation\/anno-48530377.json",
      "@type": "oa:Annotation"
    }
  ]
}

When retrieved via the API GET method:

{
  "images": [
    {
      "[resource][service][profile]": "http:\/\/library.stanford.edu\/iiif\/image-api\/1.1\/conformance.html#level1",
      "[resource][service][@id]": "http:\/\/ids.lib.harvard.edu\/ids\/iiif\/48530377",
      "[resource][format]": "image\/jpeg",
      "[resource][height]": "109517",
      "[resource][width]": "6251",
      "[resource][@id]": "http:\/\/ids.lib.harvard.edu\/ids\/iiif\/48530377\/full\/full\/full\/native",
      "[resource][@type]": "dcterms:Image",
      "[on]": "http:\/\/oculus-dev.harvardx.harvard.edu\/manifests\/drs:48309543\/canvas\/canvas-48530377.json",
      "[motivation]": "sc:painting",
      "[@id]": "http:\/\/oculus-dev.harvardx.harvard.edu\/manifests\/drs:48309543\/annotation\/anno-48530377.json",
      "[@type]": "oa:Annotation"
    }
  ]
}

Allow Interface to use multiple collections

Currently, it is looking for /collections/manifests

The interface should allow a user to add and select a variety of different collections such as "broken", "multi-volume", "fixtures", etc. to better organize test data. This would require an additional route in express.js that lists all the existing collections.

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.