@ifyour/deeplx
TypeScript icon, indicating that this package has built-in type declarations

0.1.17 • Public • Published

DeepLX

⚡️ DeepLX API npm package.

test dw

Usage

npm i @ifyour/deeplx

In your backend service, install and use this package, you can use any backend framework you like. Here's a demo of my deployment on AirCode, you can click here to deploy one of your own.

import { query } from '@ifyour/deeplx';

export default async function(params, context) {
  return await query(params);
}
curl --location 'https://nw6usm5uha.us.aircode.run/demo' \
--header 'Content-Type: application/json' \
--data '{
    "text": "你好,世界",
    "source_lang": "zh",
    "target_lang": "en"
}'
{
  "code": 200,
  "message": "success",
  "data": "Hello, world.",
  "source_lang": "zh",
  "target_lang": "en",
  "alternatives": ["Hello, World.", "Hello, world!", "Hi, world."]
}

demo

Dev

yarn install

# You need to install bun, please refer to https://bun.sh
yarn run dev

yarn run test

yarn run lint --fix

Known issues

Based on current testing, Cloudflare and Cloudflare-based edge function runtimes (Vercel) are not able to correctly request the DeepL server, and a 525 error occurs, a detailed description of the issue can be found here.

For this case, it can be solved using the DeepL proxy server, please refer to the code example.

License

DeepLX is available under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i @ifyour/deeplx

Weekly Downloads

156

Version

0.1.17

License

MIT

Unpacked Size

74 kB

Total Files

23

Last publish

Collaborators

  • ifyour