Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

501
Visualizações
How to connect Influxdb data in Vue app with node.js?

I have a InfluxDB that i want to connect to my vue app. I already made the connection to the DB and I'm able to log the data in the terminal (not console) with the code below:

// index.js
import express from "express";

// These lines make "require" available
import { createRequire } from "module";
const require = createRequire(import.meta.url);

import store from '../store/index.js'
store.getters.config
//Initialize the Client-----------------------------------
const {InfluxDB, flux} = require('@influxdata/influxdb-client')
const url = 'http://193.174.28.232:5102';
const token = 'qE83Rq0yQPGek6teUu745OkrOKW7jmInL5QrMq48-VIaXOagxPP3B8fvATAZsi7avaOlOSuMI0lRAKY9h9hnxg=='
const org = 'TeamEE'
const bucket = 'fdre818'
const client = new InfluxDB({url: url, token: token})
const o = [] 
const speed = []

//Execute a Flux query---------

const queryApi = client.getQueryApi(org)
const query = flux`from(bucket: "fdre818") 
  |> range(start: 2022-04-20T10:00:00Z, stop: 2022-04-20T10:02:00Z)
  |> filter(fn: (r) => r._measurement == "86B20CC8")
  |> filter(fn: (r) => r._field == "Speed")
  |> aggregateWindow(every: 5s, fn: mean)
  |> map(fn: (r) => ({ r with _value: r._value * 3.6 }))
  |> limit(n: 10)`
queryApi.queryRows(query, {
    next(row, tableMeta) {
        const o = tableMeta.toObject(row)
        speed.push(o._value)
    
    },
    error(error) {
        console.error(error)
        console.log('Finished ERROR')
    },
    complete() {
        console.log('Finished SUCCESS')
        store.state.suppliedInflux.speed =  speed;
    },
})

export {client}

Now i want to get that data to my vue component and that's not working. I tried to import the influxdb.js file with import * as Influxdb from '../database/influxdb.js' That gives me the error:

enter image description here

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The Solution is:

Just imported @influxdata/influxdb-client-browser in place of @influxdata/influxdb-client. See influxdb-client-js installation for details.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda