Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose resources over HTTP #33

Open
pemrouz opened this issue Dec 25, 2016 · 0 comments
Open

feat: expose resources over HTTP #33

pemrouz opened this issue Dec 25, 2016 · 0 comments

Comments

@pemrouz
Copy link
Collaborator

pemrouz commented Dec 25, 2016

Ripple resources are based on REST, so it should be fairly easy to enable serving them over HTTP. A request-response would simply be a strict subset of the realtime behaviour and just return a snapshot in time.

The HTTP request just needs to be translated to a request object (e.g. verb -> type, URL -> name, body -> value) and then passed to the existing resource handlers. The generic actions/mutations in use are (each of which can be an arbitrarily deep operation by specifying a key):

{ type: 'add', key: 'a.b.c', value }
{ type: 'update', key: 'a.b.c', value }
{ type: 'remove', key: 'a.b.c' }

Acceptable HTTP requests would be:

  • GET is a pull but without setting up a subscription.
  • PUT is an update at the root of the resource (i.e. with no key specified).
  • DELETE is a remove at the root of the resource (i.e. with no key specified).
  • POST/PATCH can just accept any change object as the body.

This would be useful for interoperability with existing tools like curl, or allowing developers to use fetch if desired.

Bonus: We can also auto-generate perfect hypermedia API with links by checking the media-type (e.g. application/hal+json) and returning the correct format with the link information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant