Files
signalk-plugin/plugin/routes/helm.js
2026-03-11 15:25:03 +01:00

31 lines
943 B
JavaScript

const path = require("path");
const websPath = path.join(__dirname, "..", "public");
/**
* Registers helm/steering support routes.
* @param {Object} router - Route wrapper with get/post methods
*/
function registerHelmRoutes(router) {
router.get("/helm", (req, res) => {
try {
const side = req.query.side || "destra";
const helmPath = path.join(websPath, "steering_support", `helm_steering_${side}.html`);
res.status(200).sendFile(helmPath);
} catch (e) {
res.status(500).json({ error: e.message });
}
});
router.get("/helm/support", (req, res) => {
try {
const indexPath = path.join(websPath, "steering_support", "steering_support.html");
res.status(200).sendFile(indexPath);
} catch (error) {
res.status(500).json({ error: error.message });
}
});
}
module.exports = registerHelmRoutes;