jichan.org
/
tatoeba-api-node
بایگانی شده
1
0
انشعاب 0
Want to contribute? Fork me on Codeberg.org!
A proxy of the Tatoeba API with no CORS restrictions. https://jichan.org/api/tatoeba
شما نمی توانید بیش از 25 موضوع انتخاب کنید موضوع می‌بایستی با حروف یا شماره ها شروع شود. و می‌تواند شامل دَش ('-') باشد و طول آن تا 35 کارکتر نیز امکانپذیر است.
این مخزن بایگانی شد. شما می توانید فایل های آن را مشاهده کنید یا از رونوشت تهیه کنید. اما دیگر نمی‌توانید آن را به‌روزسانی کنید و یا برای آن مسئله یا تقاضای واکشی ایجاد کنید.
Elnu 5896f27c44
Update repository links
1 سال پیش
.gitignore Ignore nginx config file 2 سال پیش
LICENSE Create LICENSE 2 سال پیش
README.md Create README.md 2 سال پیش
ecosystem.config.js Add PM2 ecosystem file 2 سال پیش
index.js Remove unused testing term variable 2 سال پیش
package-lock.json Downgrade to node-fetch v2, latest doesn't support require 2 سال پیش
package.json Update repository links 1 سال پیش

README.md

tatoeba-api

A proxy of the Tatoeba API with no CORS restrictions.

The only Tatoeba API currently has an issue where it's CORS policy blocks it from being used by JavaScript in the browser. This is a mirror of the Tatoeba API that has Access-Control-Allow-Origin: * set to circumvent this issue. I am hosting this at tatoeba.elnu.com until Tatoeba has a proper API implementation.

Usage

For information about API usage, see the official documentation.

This API mirror is a mirror of https://tatoeba.org/eng/api_v0/search. So, for example, https://tatoeba.org/en/api_v0/search?query=dog can be rewritten to https://tatoeba.elnu.com/?query=dog if you are using the version of the API I am hosting. For self-hosting, see Self-hosting.

Self-hosting

tatoeba-api requires Node.js and npm.

Install the depenedencies:

npm i

Running

Run tatoeba-api at port 3000 (the default):

node index.js

Run tatoeba-api at port 5000:

node index.js 5000

Running as background process

tatoeba-api can be easily run as a background process using pm2.

Install pm2:

npm i pm2 -g

The configuration for pm2 is stored in ecosystem.config.js, which by default sets it to run at port 5000 instead of 3000. To change the port, open this file and change the args field.

Start process:

pm2 start

For running starting the API at boot and more, see the pm2 documentation.