name-db icon indicating copy to clipboard operation
name-db copied to clipboard

Add features to the API

Open bluzi opened this issue 7 years ago • 4 comments

Currently, all the API can do is to search an exact name/alias in the database and return its meaning and translations. We need more features, such as:

  • Search (/search/:term) - Should return a list of matches by a partial term (Search in both aliases/names)
  • Get translation (/:name/:language) - Should return the translation of :name in :language

Anything else you can think of :)

You can easily run the API just by cloning the repo and run npm install && npm start, then you should be able to browse to http://localhost:3000 and see the API is running. Your clone will connect to the actual production database, however the user supplied there is only able to select, and is limited by its number of queries per hour.

If you need help or have any ideas, feel free to comment here.

bluzi avatar Oct 27 '17 22:10 bluzi

Hello bluzi, I'd like to give this a shot! Would you like /:name/:language to be an ISO 639-3 code or the full name of the language? (ex. "spanish" vs "spa")

CodeWritingCow avatar Oct 28 '17 03:10 CodeWritingCow

Hey @CodeWritingCow, great question :) I'm thinking: Why not both? if the input is 3 letters long, assume it's an ISO code. Otherwise, assume it's a full name of a language

bluzi avatar Oct 28 '17 10:10 bluzi

Added search endpoint in #228 :)

arminkhoshbin avatar Oct 29 '17 01:10 arminkhoshbin

I created a proof of concept for the get translation endpoint, then realized someone had already started this in #217. Probably better them than me, I have no idea how Promises work so it was really hacked together. Just putting this here so people know that it's been started and don't spend time working on a duplicate feature.

roastchicken avatar Nov 01 '17 05:11 roastchicken