Good evening to everyone,i am trying to get the graphics info from systeminformation node_module but nothing is displayed in my ejs page. I tried to display the gpu name in my console so i did, but my function is not working on the /home page. My public folder has a main web page with a link to the /home page.Everything seems to work fine except that gpu name problem.
Can anyone help me?
My index.js file
const express = require("express");
const app = express();
const path = require("path");
const si = require("systeminformation");
app.use(express.static("public"));
app.set('view engine', 'ejs');
app.set('views',path.join(__dirname,'/views'))
app.get('/home',(req,res) => {
const gpu = si.graphics().then(res => {
return res.controllers[0].model;
})
const printGpu = () => {
gpu.then((a)=>console.log(a))
}
const gpuRes = printGpu();
res.render("home.ejs",{gpuRes})
})
app.listen(3000,() => {
console.log("listening on port 3000")
})
In my home.ejs file
i got the
<body>
..
<h2><%= gpuRes %></h2>
..
</body>