wh-iterabb-it / meowfacts Goto Github PK
View Code? Open in Web Editor NEW🐈 a simple api which returns a catfact
Home Page: https://meowfacts.herokuapp.com/
License: MIT License
🐈 a simple api which returns a catfact
Home Page: https://meowfacts.herokuapp.com/
License: MIT License
Thank you for creating such wonderful and fascinating open-source software.
I am interested in translating this project into Japanese. Would that be alright?
I am thinking about changing the docker image from node:14 to something a lot smaller, i used to alpine back in the day, but am aware there are some better ones now.
https://meowfacts.herokuapp.com/?count=4 only returns a single fact still? perhaps I am using it wrong?
The repo has been neglected for a bit, and some best practices can easily be implemented to the repo to make it better.
These are mostly security-related updates, refactoring to get rid of technical debt and make future feature/fixes easier.
master
-> main
and automation that goes with thatIn the Dockerfile, the ports exposed are from range 3000-5001 whereas the application only uses port 5000
Even though it does not creates any major difference, It can create unnecessary confusion to anyone who is reading the Dockerfile for Reference
Migrate Server-side-tools to sst
Bumps prettier from 2.8.8 to 3.0.3.
Facts needed Translating in Tagalog (Filipino)
Localization
Please make any PR that adds additional translated facts to the file.
Main Issue: #175
Translate cat facts to Tagalog (Filipino)
First outlined by @nickcrisci in a very well-thought-out and great contribution PR #206
I wanted to define a little bit how this change works and outline some of its improvements in an issue.
src/models/localization/
with some additional fields, and no longer need to edit /middleware
or other files to configure accepting the new languages.[TO-DO] @BeauBouchard CC @switchhalt [fill this part out in more detail]
We want to adhere to the Standards for Content-Language and Accept-Language going forward.
Note: Language tags are formally defined in RFC 5646, which rely on the ISO 639 standard (quite often the ISO 639-1 code list) for language codes to be used.
Adds a short configurable field at the top of the facts
file which specifies our agreed on conventions for querying it in the I18N codes we use.
In this example, we add a new language file for Canadian English
.
It would be src/models/localization/eng-ca.js
and look like
const facts = [
"Cats have been the most popular pet for families in Canada since data was first collected in 1987.",
"..."
];
const langName = "English", // normally this is the language name
langISO = "eng",
langLocale = "ca",
langLocaleName = "Canadian";
module.exports = {
langName,
langISO,
langLocale,
langLocaleName,
code: `${langISO}-${langLocale}`,
codeName: `${langName} (${langLocaleName})`,
facts: facts,
};
If you query the api with eng-ca
language parameter you will get the facts appearing more for the tailored localization in the language of english.
Feel free to change the facts to be more meaningful to the location you want, as the original english facts are with america in mind, I would love to see what other places have for accurate and high quality facts about cats.
We want to have a copy of the COC and Contributing pages appear in all readmes from links. we can consolidate those to a single org repo, or put them in the /docs/ of the repos.
Referencing another organization, free-ignorance/fortunecookie#163 where we are trying to uniformly adopt a COC.
I think we did it previously in /shrewd/ but I am very open to doing it differently if we are going to have the same policy for all public repos.
/docs
folder./docs
folder.Facts needed Translating in Portuguese (Brazil)
Localization
Please make any PR that adds additional translated facts to the file.
Main Issue: #175
Translate 90 cat facts to Portuguese
translate cat facts to Nepali (np).
Previously we let codecoverage reporting from codecov to continue to be disabled after the previous issues they had a few years ago.
Overall I would like to have a codecoverage service still, and due to the public nature of this codebase, we want to re-enable this service and repair its integration.
README.md
I think the standardized nomenclature for languages is not accurate in the README.
The column table "ISO 639-1" is not exactly the wikipedia description of "two-letter codes"
And this section says that you intend to use RFC 5646 but is different from this list
Request: Use RFC 5646 for README and folders name.
Facts needed Translating in
./src/models/localizations/kor-ko.js
const facts = [
"..."
];
const langName = "Korean", // normally this is the language name
langISO = "kor",
langLocale = "ko",
langLocaleName = "Korean";
module.exports = {
langName,
langISO,
langLocale,
langLocaleName,
code: `${langISO}-${langLocale}`,
codeName: `${langName} (${langLocaleName})`,
facts: facts,
};
Inspired by #175 (comment) from Main Issue: #175
I looked at the facts list, and the word cat in the indonesian language mentioned is wrong. Instead of "qitta", it should be "kucing", the same as Malay.
Description
return the whole language list in the 400
error the middleware serves when requesting with the wrong language.
See this line: https://github.com/wh-iterabb-it/meowfacts/blob/main/src/middleware.js#L56
shortISO.join(", ")
should be VALID_LANGUAGES.join(", ")
as that is what is being checked against above in validateLanguage
function, and the correct way we should respond.
Objectives to fix
I tried the url to get more than one cat fact but it is not working ie curl https://meowfacts.herokuapp.com/?count=3.
I want to convert the existing YAML to a JSON file, and use that going forward from our repo.
/health
endpoint/options
endpointYAML
to JSON
ita-it.js
in the src/models/localization/
folderconst facts = [
"a single fact per a line :D",
"..."
];
const langName = "Italian",
langISO = "ita",
langLocale = "it",
langLocaleName = "Italy";
module.exports = {
langName,
langISO,
langLocale,
langLocaleName,
code: `${langISO}-${langLocale}`,
codeName: `${langName} (${langLocaleName})`,
facts: facts,
};
Feel free to change the facts to be more meaningful to the location you want, as the original English facts are with America in mind, I would love to see what other places have for accurate and high-quality facts about cats.
English name of Language: Italian
ISO 639-2/BT Language Code: ita
Language Dialect Local: Italy
Please make any PR that adds additional translated facts to the file.
Note: Please forgive me if I use language or terminology incorrectly, please do correct me and we will all learn together how things are expressed differently in other places.
Main Issue: #175
Facts needed Translating in Urdu (Pakistan)
Localization
Please make any PR that adds additional translated facts to the file.
Main Issue: #175
Translate cat facts to Urdu (Pakistan)
Implement the previously used count
query param to allow multiple facts in a response.
Called out in issue:
#98
zho-tw.js
in the src/models/localization/
folderconst facts = [
"a single fact per a line :D",
"..."
];
const langName = "Chinese",
langISO = "zho",
langLocale = "tw",
langLocaleName = "Taiwan";
module.exports = {
langName,
langISO,
langLocale,
langLocaleName,
code: `${langISO}-${langLocale}`,
codeName: `${langName} (${langLocaleName})`,
facts: facts,
};
Feel free to change the facts to be more meaningful to the location you want, as the original English facts are with America in mind, I would love to see what other places have for accurate and high-quality facts about cats.
English name of Language: Chinese
ISO 639-2/T Language Code: chi
ISO 639-2/B Language Code: zho
Language Dialect Local: Taiwan
Please make any PR that adds additional translated facts to the file.
Note: Please forgive me if I use language or terminology incorrectly, please do correct me and we will all learn together how things are expressed differently in other places.
Main Issue: #175
Hi, I would like to contribute with an italian translation. Please let me know how to do that. Thanks
I know bengali very well so I want to add bengali language support to this api.
Does it have any contribution docs to guide me how to add a new language support ?
Add a contribution guide.
Facts needed Translating in Bengali for India location
./src/models/localizations/ben-in.js
const facts = [
"..."
];
const langName = "bengali",
langISO = "ben",
langLocale = "in",
langLocaleName = "India";
module.exports = {
langName,
langISO,
langLocale,
langLocaleName,
code: `${langISO}-${langLocale}`,
codeName: `${langName} (${langLocaleName})`,
facts: facts,
};
Querying esp
has 2 files it can go to in ./src/models/localizations
folder, we wanted originally to one to be the default, if the short code is used for the request.
Example of bug:
User is querying the endpoint with ?lang=esp
We want to control the default behavior to go to the esp-es
or esp-mx
response.
While trying to translate I learned a lot and direct translations may not be the most accurate. I am always looking for suggestions and help in this regard and let this issue stand as a call for maintainers or contributors who want to improve the translation or even help make the API available in different languages.
I18N means Internationalization with 18 letters between I and N, its often abbreviated. Supporting languages isn't always easy, as languages often have regional dialects which is why they created the word localization
. This is mapping the language to a location, an easy example of this is thinking of french in Canada or France, Spanish in Mexico vs Spain, or American English vs England's English.
We want to adhere to the Standards for Content-Language and Accept-Language going forward.
Note: Language tags are formally defined in RFC 5646, which rely on the ISO 639 standard (quite often the ISO 639-1 code list) for language codes to be used.
In this example, we add a new language file for Canadian English
.
We only need to make a single file, It would be src/models/localization/eng-ca.js
and look like
const facts = [
"Cats have been the most popular pet for families in Canada since data was first collected in 1987.",
"..."
];
const langName = "English", // normally this is the language name
langISO = "eng",
langLocale = "ca",
langLocaleName = "Canadian";
module.exports = {
langName,
langISO,
langLocale,
langLocaleName,
code: `${langISO}-${langLocale}`,
codeName: `${langName} (${langLocaleName})`,
facts: facts,
};
If you query the api with eng-ca
language parameter you will get the facts appearing more for the tailored localization in the language of english.
Feel free to change the facts to be more meaningful to the location you want, as the original English facts are with America in mind, I would love to see what other places have for accurate and high-quality facts about cats.
:D Looking forward to all contributions
we moved from 14 to 16, lets put that in the package.json for future apps to leverage
"engines": {
"node": "16.x"
}
Translate the 99 catfacts into Spanish, we are targeting 2 locals for this :
a second initiative is to support pt-BR (Portuguese/Brazil) later on.
Documentation needs to have the new GET query params included, as well as new lang / i18n needs to be documented. this is almost technical debt as these features are already out the door :D
lang
GET param definition and rulescount
GET param definition and rules/:id
GET route definitionlang
GET param definition and rulescount
GET param definition and rules/:id
GET route definitionTranslate the 99 catfacts into german.
we can no longer npm install
correctly without github access credentials for the sst repo (?)(unsure)
recently sst and i think a dep from it made it so it can't be installed.
This causes development to break noted in #194
We need to refactor a few functions out of SST or fix SST https://github.com/wh-iterabb-it/sst which hasn't had its issue identified yet.
To enhance the usability and adoption of our backend API, we need to create an interactive documentation page that guides new users on how to implement the API effectively. This documentation will serve as a comprehensive resource for developers, providing step-by-step instructions, examples, and detailed explanations.
I propose building a dedicated web page within our project repository that will host the API documentation and implementation guide. This page will be designed using modern web technologies and will provide a user-friendly experience to developers, regardless of their experience level. The documentation will be presented in a clear and concise manner, making it easy for new users to understand and implement our API.
The following key features are suggested for the interactive documentation page:
Introduction and Getting Started: An overview of the API's purpose, its capabilities, and a guide on how to get started using it.
Endpoints and Parameters: A detailed listing of all available endpoints, along with their associated parameters and expected responses.
Authentication and Authorization: Guidance on how to authenticate requests and obtain necessary access tokens or API keys.
Code Examples: Practical code snippets demonstrating how to use the API in various programming languages, making it easier for developers to integrate it into their projects.
Error Handling: Information on error responses, common troubleshooting tips, and best practices for handling errors gracefully.
FAQs and Troubleshooting: A section that addresses frequently asked questions and common issues developers may encounter while implementing the API.
Please feel free to ask any questions or suggest additional features that would enhance the usability and effectiveness of our API documentation. Let's work together to make our API implementation guide a valuable resource for all developers!
Programableweb no longer exists as of Feb 2023, We previously had a lot of exposure from their listing as a learning resource, and would like to document the free api on other platforms. rapidapi is a robust platform which has a lot of good free resources for small teams, it also gets people started using the api with code snippets and allows for people to query the api in a postman
like web panel.
rapidapi
README.md
with new link to the rapidapi pageorganization account
https://rapidapi.com/orghomepage/wh-iterabb-it
This API is listed publicly now here:
https://rapidapi.com/wh-iterabb-it-wh-iterabb-it-default/api/meowfacts/
We link to it, and will do our best to keep the documentation in sync
found 17 vulnerabilities (1 moderate, 15 high, 1 critical)
being honest about the integrations with the other services found a lot of things that need fixing...
Main Issue: #175
Translate 90 cat facts to Hindi
Big thanks to amiarham who added 3 facts to eng-US.js in #183 .
We now need to translate these 3 facts into the other 2 locals to make sure we are having the same experience for all languages we support.
"Cats can jump up to six times their length.",
"Cats have contributed to the extinction of 33 different species.",
"Cats can drink sea water in order to survive.",
Description of changes
Ideally we can have some examples using the api with different clients. Having a separate markdown page in ./docs/
at least outlining front-end requests is a great learning resource and helps get people started. I also like a lot of the other tutorials in the wild, and would love to have our own we update a bit.
Objectives
react
example that does an HTTP GET` request to the API.count
and lang
Description of changes
Creating a new endpoint at /options
which returns an array of language objects in its response.
Each local/language in the ./localization
folder should get its own object.
lang
object displaying the following attributes:
iso_code
and locale_code
separated by a dash -
, example: "ces-cz"local_name
, english_name
and full_code
, like Čeština/Czech (ces-cz)
example of response:
{
"lang": [
{
"locale_code": "cz",
"iso_code": "ces",
"full_code": "ces-cz",
"local_name": "Čeština",
"english_name": "Czech",
"full_name": "Čeština/Czech (ces-cz)",
"fact_count": 94,
},
{
"locale_code": "de",
"iso_code": "deu",
"full_code": "deu-de",
"local_name": "Deutsch",
"english_name": "German",
"full_name": "Deutsch/German (deu-de)",
"fact_count": 99,
}
]
}
This will allow the discovery of which languages are available, and how many facts are available in each.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.