Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

138
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!