Project

General

Profile

How can I run nodeJS code in my plugin?

Added by Eloise Chizat about 10 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 Martin Denizet (redmine.org team member) about 10 years ago

Hello Eloise,

From what I know, 3 scenarios:
  1. You want to use a publicly exposed NodeJS service. In that case just make an ajax call to your service (jQuery).
  2. 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.
  3. 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 10 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 10 years ago

Hi,

I want to use an executable, so I use the number 3 and it works !

Thanks!

Eloïse

    (1-4/4)