mediachain / L-SPACE

[DEPRECATED] Books = Knowledge = Power = (Mass x Distance^2) / Time^3
MIT License
9 stars 1 forks source link

Spray / Akka API boilerplate #56

Closed yusefnapora closed 8 years ago

yusefnapora commented 8 years ago

This is an in-progress branch with a spray based api service that talks to the orient graph to address #52

At the moment, you can run sbt 'project api_server' 'run-main io.mediachain.api.Boot' to listen on localhost:8888.

There's only two functional routes so far:

These return JSON objects using the default json4s serializer (or an array of objects for the list endpoint). The id field is currently incorrectly serialized as an empty object. I think we can add a serializer for ORecordId to the DefaultFormats to convert it to a string without too much fuss.

The biggest missing piece here is the concurrency model; the routes should probably be returning Futures instead of performing blocking db calls directly. This looks relevant: http://spray.io/documentation/1.2.3/spray-routing/future-directives/

The route structure is defined in the LSpaceService trait. At the moment the methods that actually traverse the graph are defined in the same file, but we should move them as we start building out a bigger api.

parkan commented 8 years ago

We should discuss whether we want to continue using spray/akka in the long term, I kind of share some of vyzo's concerns. Let's hold off on this merge for the moment

parkan commented 8 years ago

Can close this, presumably