David Godin - I've been banging my head on this...
I've been banging my head on this v2 api trying to register a path. Any clue what I'm doing wrong?
registerWithRouter(router) {
router.get('/signalk/v2/api/vessels/self/demopluginGet', (req, res) => res.json({message: 'test ok'}));
}
All I can manage to get is 404:
Sep 06 15:31:31 2025-09-06T15:31:31.169Z signalk-server:tokensecurity http_authorize: /signalk/v2/api/vessels/self/demopluginGet (forLogin: true) Sep 06 15:31:31 2025-09-06T15:31:31.171Z signalk-server:tokensecurity verify Sep 06 15:31:31 2025-09-06T15:31:31.171Z signalk-server:tokensecurity authorized Sep 06 15:31:31 GET /signalk/v2/api/vessels/self/demopluginGet 404 29.367 ms - 180
3 Replies
Registerwithrouter is for adding routes for plugin’s own functionality, not for extend the signalk apis
What are you trying to achieve?
This is my first plugin so I'm lost...
I am trying to create a plugin using v2 API. I want to remotely change KIP dashboards so I need a plugin that writes to paths.
Initially I wanted to use PUT handlers but found out you can't register PUT handlers with wildcard paths like:
displays.*.screens
where * are the KIP instances UUID.
So I'm trying to use v2 http put with params instead to write to paths like : /displays/:kipId/screens
I've been reading the documentation but I obviously don't understand the basics yet.
My above example is for a GET but I was just trying to simplify for testing...
I just found in the doc that routes will be under /plugins/id ! It works!
@Teppo Kurki Do you know how I can npm link
my projet folder using Docker instances? I have a mount for the .signalk folder but if I npm link
from the project folder and npm link @mxtommy/kip
in the .signalk mount folder it does not work. I can manually follow the link and it goes to the right place but when I restart the Docker instance it can't use the link for some reason. Any clue?Much easier if you just place your Kip directory directly under .signalk/node_modules/@mxtommy
If you use npm link you must do it inside the container, not on the host