Issue
I currently have a Raspberry Pi with a GPS dongle which is successfully getting coordinates. I can see all the information i need if i run cgps -s and my ultimate goal is to display this in a HTML page. I am currently using NodeJS as a server.
How can I access the GPS information from either a webpage or the NodeJS server?
Solution
You should be able to run a Linux command in a NodeJS application using child_process.exec
const exec = require('child_process').exec;
const child = exec('cgps -s',
(error, stdout, stderr) => {
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
if (error !== null) {
console.log(`error: ${error}`);
}
});
Answered By - Mo Nazemi