Aggiunto collegamento al server
This commit is contained in:
30
plugin/routes/helm.js
Normal file
30
plugin/routes/helm.js
Normal file
@@ -0,0 +1,30 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user