Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

140
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda