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

137
Visualizações
How to store data from a MariaDB in my node.js environment

I have a MariaDB that stores Energy-Data like voltage, frequency and so on. My aim is to visualize the data in a Web-application. Though i achieved to connect the MariaDB to node.js and log the data on a specific port thanks to the code below, i don't have a clue how to store this data for further mathematic operations or visualizations.

How can i store the data for further operations?

const express = require('express');
const pool = require('./db');
const app = express();
const port = 4999;

// expose an endpoint "persons"
app.get('/persons', async (req, res) => {
    let conn;
    try {
        // make a connection to MariaDB
        conn = await pool.getConnection();

        // create a new query to fetch all records from the table
        var query = "select * from Herget_Netz2_WirkleistungL1";

        // run the query and set the result to a new variable
        var rows = await conn.query(query);

        console.log('Daten kommen');
        

        // return the results
        res.send(rows);
             
    } catch (err) {
        throw err;
    } finally {
        if (conn) return conn.release();
    }
});

app.listen(port, () => console.log(`Listening on pfort ${port}`));
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

This question is quite broad.

It sounds like you need to set up a frontend and call fetch on your endpoint, something like:

fetch(<your-url>/persons)
  .then(r => r.json())
  .then(yourData => "<p>" + yourData "</p>")

Your data will be interpolated into HTML then. You will need to iterate over it.

The "storage" will take place in the variable you define in the second .then(yourData) of the promise for you to do further operations on.

You should search for tutorials like "set up frontend with maria db database and node backend".

about 4 years ago · Juan Pablo Isaza 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