Search code examples
expressrequestnestjscondition-system

How to query conditions for request in nestjs?


I want to implement a system for query conditions in requests.

for example, if I want to say get objects with the id of less than 2 send this request.

https://example.com/getObjects?id_less=2

Is there any way to do this in nestJS or express or anything else... . Or I should create this by myself?

Thanks in advance 🙌


Solution

  • Finally, I create it by myself and push it on GitHub's gist.

    I use typeorm Query Options to do that. also first split queries and use some words like less, more, meq, ... to detect what condition is should be implemented.

    You can find this here on Github Gist 🙌
    Enjoy ✨