Giter Site home page Giter Site logo

Comments (6)

Maelstromeous avatar Maelstromeous commented on August 23, 2024 1

Which spits out object:

{ where: { world: 17 }, order: { zone: 1 }, limit: 50, skip: null }

Which is then accepted by Mongo and processed using their typehinted object FindManyOptions, fully supporting pagination etc. My intent is we treat it basically how we'd treat any mongo instance.

from api.

microwavekonijn avatar microwavekonijn commented on August 23, 2024

That is a proprietary format. A normal format based on the example would be:

GET /some/endpoint/1234?filter[instance]=10-37435&filter[facility][gt]=7000&sort[timeStarted]=1

But if you start looking at such flexibility I would seriously start considering grapQL.

Also considering that most instance collections(except maybe deads) will be around ~1000 records I think sorting can be done locally easily.

from api.

zhenghung avatar zhenghung commented on August 23, 2024

I'm not sure how I feel about passing in json strings as a query. I've never seen it implemented like that.

from api.

Maelstromeous avatar Maelstromeous commented on August 23, 2024

@microwavekonijn

That is a proprietary form

It's not, it's literally what you pass to mongo compass, essentially we're mocking exactly that object literal into the query, parsing it, then passing it to the mongo platform to pull out via the API. We're also declaring against the where calls directly so it presumably won't be open to any kind of injection.

I'm not sure how I feel about passing in json strings as a query. I've never seen it implemented like that.

It'll be up to the client implementation to parse it as a URL encoded string, which I've seen many times, and is pretty safe unless you're using weird things like emoji.

Example:

GET http://dev.api.ps2alerts.com/instances/territory-control?filter=%7B%22world%22%3A17%7D&sort=%7B%22zone%22%3A%201%7D

aka

GET http://dev.api.ps2alerts.com/instances/territory-control?filter={"world":17}&sort={"zone": 1}

Will return a ascending sorted array of territory control alerts from Emerald.

from api.

microwavekonijn avatar microwavekonijn commented on August 23, 2024

I would be very careful with it and have some strict validation in place. But it is still a proprietary form, not as much as how we use it internally but definitely seen from the client server communication. I don't like it, but I won't object.

from api.

Maelstromeous avatar Maelstromeous commented on August 23, 2024

Superceded by #64 .

from api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.