This is what I get:
const client = new InfluxDB({localhost:1881, YvaWtjRk7lisdwbtZfXn30VhyqW8LBoweKLIv2DAt9dJlVtdAv4dRCHkYdbJv5d1JLY26Qy-Wnb8J1J9S_gOag==})
^
Uncaught SyntaxError: Unexpected token ‘-’
What am I doing wrong?
This is what I get:
const client = new InfluxDB({localhost:1881, YvaWtjRk7lisdwbtZfXn30VhyqW8LBoweKLIv2DAt9dJlVtdAv4dRCHkYdbJv5d1JLY26Qy-Wnb8J1J9S_gOag==})
^
Uncaught SyntaxError: Unexpected token ‘-’
What am I doing wrong?
In your node.js code, you’re passing the token string raw which is incorrect, you need to pass it as strings. Here is one way to do it and also you can also store the ‘values’ as environment variables and pass those instead of hard coding it.
import { InfluxDB } from '@influxdata/influxdb-client'
const influxDB = new InfluxDB({
url: '``http://localhost:8086``',
token: 'YOUR_API_TOKEN'
}