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

Feature: Make custom HTTP methods #81

Closed
omani opened this issue Jan 20, 2017 · 3 comments
Closed

Feature: Make custom HTTP methods #81

omani opened this issue Jan 20, 2017 · 3 comments

Comments

@omani
Copy link
Contributor

omani commented Jan 20, 2017

Hi,

it would be super awesome to be able to create or have custom http verbs (methods) so I can be more flexible with my own storage handler (Storer).

Something like

curl -XOPEN /api/some/route/to/media/file
curl -XBAN /api/some/route/to/bridge/ip
curl -XDELEGATE /api/some/route/to/proxy/zone

can we implement this or any plans to make this happen?

@rs
Copy link
Owner

rs commented Jan 20, 2017

Not really. The whole idea is to abstract the rest layer from the storage layer. Thanks to that you can swap the rest layer for the GraphQL layer with no change on your storage layer.

You can write a custom layer to replace rest and reuse the resource package with the same storers if you want.

@smyrman
Copy link
Collaborator

smyrman commented Jan 20, 2017

I think most REST-APIs tend to be CRUD or CRUDL, like rest-layer.

That means that if you want to DELEGATE a proxy/zone, you do so with a -X PATCH where you e.g. change the state and assign something, and/or install an appropriate hook.

I don't know what use case you are considering, but if you want custom methods (that perhaps even take parameters), perhaps you want too look into RPC frameworks, e.g. https://capnproto.org/ or http://www.grpc.io/?

@omani
Copy link
Contributor Author

omani commented Jan 20, 2017

yeah I could work with hooks, a custom layer and the like. I just thought it would be far easier to implement new features of my own rest API by defining new http methods and attach the appropriate function to them.

but you both are right, it's not the way rest should be used. in rest terms. that's why your suggestion with grpc makes sense to me.

I can work with queries and/or hooks. thanks guys.

@omani omani closed this as completed Jan 20, 2017
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

3 participants