-
-
Notifications
You must be signed in to change notification settings - Fork 46
Feat word list api #257
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
base: main
Are you sure you want to change the base?
Feat word list api #257
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- /api/v1/words.json for word list in JSON format - /api/v1/words.txt for word list in TEXT format
9d79e73 to
3ce7e6c
Compare
| export async function GET() { | ||
| const dictionary = await getCollection("dictionary"); | ||
| const words = dictionary.map((word) => { | ||
| return word.data.title.toLowerCase(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be beautiful if we can make the words data available exactly as is from our end... i.e.
- Provide the word title exactly as it, no case transformation
- Make the word slug available
- Make the meaning string available too
This way the endpoint is more versatile, and you can choose to make it lowercase or use it however you'd like to at consumption.
See how the current endpoint is implemented at https://github.com/jargonsdev/jargons.dev/blob/main/src/pages/api/v1/browse/index.js
...and take note of my observation as how to handle the slug/id here #251 (comment)
babblebey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @d093w1z,
Thanks for making this contribution... I'd say we just do away with the txt endpoint... I don't we want that... And I'd also like it if we made the json endpoint even more useful
See the following notes in the review..
Description
This PR adds the feature of text file containing all the words for dictionary based projects (auto-complete, auto-suggestions)
#251
It creates 2 api endpoints:
/api/v1/words.txt: for a simple ASCII text file containing all the words separated by newlines/api/v1/words.json: for a JSON object of following schema:Related Issue
Implements #251
Screenshots/Screencasts
Notes to Reviewer
No new npm packages, as its just a simple text & json file api