This repository has been archived by the owner on Jan 16, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api:search): add endpoint
/api/search/[searchStr]
## what - add endpoint `/api/search/[searchStr]` ## how - check if the `searchStr` is valid (using zod schema) - must be a string length of 1 - if `searchStr` is not valid, return 400 - if username exists, add SearchResult to an array - title: `User: [username]` - href: `/users/[username]` - if problem number exists, add SearchResult to an array - title: `Problem: [problem number] [problem title]` - href: `/problems/[problem number]` - return response using the SearchResult array ## why - this endpoint will be used to search for a problem number or a username ## where - ./src/app/api/search/[searchStr]/route.ts ## usage
- Loading branch information