⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@d093w1z
Copy link

@d093w1z d093w1z commented Dec 3, 2025

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:

  1. /api/v1/words.txt : for a simple ASCII text file containing all the words separated by newlines
  2. /api/v1/words.json : for a JSON object of following schema:
  {
      total: 0; // number, total number of words
      words: []; // Array of strings containing words
  };

Related Issue

Implements #251

Screenshots/Screencasts

Notes to Reviewer

No new npm packages, as its just a simple text & json file api

@vercel
Copy link

vercel bot commented Dec 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
jargons-dev Ready Ready Preview Comment Dec 8, 2025 2:20pm

- /api/v1/words.json for word list in JSON format
- /api/v1/words.txt for word list in TEXT format
@d093w1z d093w1z force-pushed the feat-word-list-api branch from 9d79e73 to 3ce7e6c Compare December 6, 2025 14:45
export async function GET() {
const dictionary = await getCollection("dictionary");
const words = dictionary.map((word) => {
return word.data.title.toLowerCase();
Copy link
Member

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)

Copy link
Member

@babblebey babblebey left a 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..

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.

2 participants