小编Yur*_*Aps的帖子

如何在 Google Translate Node.js 代码中设置 API KEY

我正在尝试创建一个使用 google translate api 的 Node.js 代码。我从 google doc ( https://cloud.google.com/translate/docs/translating-text )得到以下代码

但是当我运行它时,它说“错误:请求缺少有效的 API 密钥。” 我有钥匙,但我不知道如何以及在哪里设置它。

async function translate() { // Imports the Google Cloud client library
    const { Translate } = require('@google-cloud/translate');

    // Creates a client
    const translate = new Translate();

    /**
     * TODO(developer): Uncomment the following lines before running the sample.
     */
    const text = 'Hello, world!';
    const target = 'ru';

    // Translates the text into the target language. "text" can be a string for
    // translating a …
Run Code Online (Sandbox Code Playgroud)

google-translate api-key node.js google-cloud-platform

8
推荐指数
1
解决办法
2147
查看次数

如何在没有MOV指令的情况下在寄存器之间移动数据?

我怎样才能像这样移动:MOV EAX, EBX不使用MOV指令?

x86 assembly

0
推荐指数
1
解决办法
1641
查看次数