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

updated and improved search api #22

Merged
merged 1 commit into from
May 25, 2021
Merged

Conversation

007vedant
Copy link
Contributor

Endpoint => /api/users/search

Updates => expects params along with endpoint unlike previously when inURL args were required.

params -> hid & name
both the parameters are optional
suppling both the params simulataneously results in bad request(obviously)

Usage =>

  1. /api/users/search
    hitting the url without any params returns response with details of all the healthOfficials in the database.

  2. /api/users/search?hid=
    hitting the url with hid returns response with details of the healthOfficial queried against it.

  3. /api/users/search?name=
    hitting the url with name returns response with details of all healthOfficials with similar names. (uses regex for string matching)

  4. /api/users/search?hid=&name=
    bad request 400

enables querying through names via regex
enables querying through id
enables global search
@007vedant 007vedant merged commit b00c782 into purplepotion:dev May 25, 2021
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

Successfully merging this pull request may close these issues.

1 participant