-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
implement eXistdb REST-api client #243
Conversation
f79ea4e
to
ce07fcf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall the api design looks good to me. Very nice feature. Get
ing collection listing in JSON might be useful, but its something i would add once we have a usecase that isn't served by xst
. Post
ing xquerys on the other hand is something that I personally would have use for, it would be nice to add that.
The Roadmap on the Readme should be updated with this PR, and it needs some documentation / sample code.
I would add another test on specs/rest.js
to ensure that exist reports the correct mimetypes for uploaded txt and xml files. This is an area of frequent problems.
6029878
to
74d3d89
Compare
@duncdrum added POST, more tests, documentation and the feature server responses that are wrapped in |
@line-o feel free to merge after rebasing, the |
node-exist exports a new async function `getRestClient` accepting the same connection options as connect did. The returned client has three methods `get`, `put` and `del` to read, create and remove resources from exist using the REST API. ``` const rc = await getRestClient(connectionOptions) await rc.put('<root />', '/db/test.xml') await rc.get('/db/test.xml') await rc.del('/db/test.xml') ```
Using the REST-client is around 20% faster in uploading files. In order to receive detailed validation errors it falls back to using the RPC-API on files where the server responded with status code 400, bad request.
The ability to require 'util/types' was introduced only with node15.
This enables easier import of connection.js in ES6 modules.
whenever a wrapped result is returned from a request to eXist-db's REST-API (for both GET and POST) the response will be extended with metadata derived from the <exist:result> elements attributes. - hits - start - count - session - compilationTime - executionTime If any of the above attributes is not set the property is set to -1.
d2a9cf9
to
3e798dd
Compare
🎉 This PR is included in version 5.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
node-exist exports a new async function
getRestClient
accepting thesame connection options as connect did.
The returned client has three methods
get
,post
,put
anddel
tointeract with eXist-db using the REST-API
see example/rest.mjs for a runnable version of above code