Conversation
- Introduced new `ledger-resource` handler for managing ledger operations. - Added middleware for extracting ledger names and operations from paths. - Implemented multi-ledger query routes and updated route maps for compatibility. - Created tests for parsing ledger operations from paths.
|
I've pulled this branch down and gotten it rebased on |
I don't disagree and not sure the right path. My thought in the way it is is that I should be able to go do http://foo.com/mydb and if I was authorized, see a web page show up. When I query, I just query the same URL... (this is why you don't need /:query appended for querying, but all other ops you need it). Also in federated queries I could just list URLs like the above (as prepending them all with /query/ seems awkward in that case... but could certainly work. I guess I was focused on the ledger being the "resource" and then operations on the resource are appended to it (or in theory could be use with REST verbs.. but I stayed away from that pattern as it seemed to add complexity where true REST isn't used all that often... so more explicit URLs I think make things more clear. Anyhow, that is why I opted for that pattern FWIW. |
|
I've got this implemented and merged in #186 It uses this URL format:
This preserves the ledger-as-resource semantic avoids the performance hit of the conflicting routes. |
Summary
This PR adds ledger-specific resource endpoints that match the Fluree serverless API pattern. The implementation allows ledger names to be part of the URL path, eliminating the need for 'ledger' fields in request payloads.
Changes
fluree.server.handlers.ledger-resourcefor processing ledger resource operationsEndpoints Added
/{ledger-name}/:create/{ledger-name}/:insert/{ledger-name}/:upsert/{ledger-name}/:update/{ledger-name}/:delete/{ledger-name}/:query/{ledger-name}/:multi-query/{ledger-name}/:history/{ledger-name}/:commitBackwards Compatibility
All existing endpoints remain functional. The new resource endpoints coexist with the current API structure.
Testing
Notes for Review
This is a draft PR for team feedback and review. The implementation focuses on matching the serverless API pattern while maintaining full backwards compatibility.