How can I run nodeJS code in my plugin?
Added by Eloise Chizat about 11 years ago
Hi!
In a Hook, I a made a button.
I want to run a nodeJS code when I push this button.
How can I do ?
Thanks =)
Replies (4)
RE: How can I run nodeJS code in my plugin?
-
Added by Eloise Chizat about 11 years ago
Maybe this can help me ? https://rubygems.org/gems/rednode
RE: How can I run nodeJS code in my plugin?
-
Added by Martin Denizet (redmine.org team member) about 11 years ago
Hello Eloise,
From what I know, 3 scenarios:- You want to use a publicly exposed NodeJS service. In that case just make an ajax call to your service (jQuery).
- You want to use a non-public NodeJS service Run your NodeJS service on localhost (listening to 127.0.0.1) and call it from the controller of your plugin.
- You want to use a task (executable). Run a
system("/my/path/executable #{param}")
command from the controller of your plugin.
I don't like solution number 3 because there is more possibilities of something going wrong.
Cheers
RE: How can I run nodeJS code in my plugin?
-
Added by Martin Denizet (redmine.org team member) about 11 years ago
I had a look to the rednode gem you mentioned.
I guess it could solve your problem.
To load the gem in you plugin, create a file name "Gemfile" at the root of your plugin with the following content:
gem 'rednode', '~> 0.1.2'
Run the logic in a controller of your plugin.
Cheers
RE: How can I run nodeJS code in my plugin?
-
Added by Eloise Chizat about 11 years ago
Hi,
I want to use an executable, so I use the number 3 and it works !
Thanks!
Eloïse