This is the big one.
Endpoint: GET /joke
Requirements:
[ ] All filters are set through query parameters (no more path params)
[ ] All filter query params follow the same general format (comma-separated, percent-encoded)
[ ] Add filters for free tier users:
[ ] Include categories
[ ] Exclude categories
[ ] Include flags
[ ] Exclude flags
[ ] Simple substring
[ ] Safe mode (opt-out, turned on by default)
Will not return jokes with any flags and from restricted categories.
[ ] Response format (JSON / XML)
[ ] Joke type (single / twopart)
[ ] Amount (up to 5 at a time)
[ ] Match joke ID
[ ] Language and/or country code
[ ] Setting the language to en could give jokes from the languages en-US, en-CA, en-UK, etc.
[ ] Setting it to en-US will only result in jokes from the language en-US
[ ] Add filters for premium tier users:
[ ] Advanced regex pattern matching (up to a set max complexity)
This may need to be done with Prisma's full-text search instead of regex (as that would require loading all jokes into memory first I imagine)
If using regex, use something like re2 to combat non-linear complexity and catastrophic backtracking (ReDoS attacks)
[ ] Amount (up to 50 at a time)
[ ] TBD: Think of more to incentivize it lol
[ ] Rate limit requests according to the user's tier:
[ ] Free users get TBD requests in TBD minutes
[ ] Premium users get TBD requests in TBD minutes
Nice to have:
[ ] Detect scraping clients and add them to the block list
This is the big one.
Endpoint: GET
/joke
Requirements:
Will not return jokes with any flags and from restricted categories.
en
could give jokes from the languagesen-US
,en-CA
,en-UK
, etc.en-US
will only result in jokes from the languageen-US
This may need to be done with Prisma's full-text search instead of regex (as that would require loading all jokes into memory first I imagine)
If using regex, use something like re2 to combat non-linear complexity and catastrophic backtracking (ReDoS attacks)
Nice to have: