Difference between revisions of "Node.js application as Windows service"

From ESS-WIKI
Jump to: navigation, search
(.)
(.)
Line 1: Line 1:
 
= Introduction =
 
= Introduction =
  
<span style="font-size:larger;">This guidelines is aim to teach you how to run your Node.js application as a Windows service.<br/></span>
+
<span style="font-size:larger;">This guidelines is aim to teach you how to run your Node.js application as a Windows service.</span>
  
 
<span style="font-size:larger;">APIGateway, created by EdgeSense Team, can be running as a Windows Service, so we take it for example in this guidelines.</span>
 
<span style="font-size:larger;">APIGateway, created by EdgeSense Team, can be running as a Windows Service, so we take it for example in this guidelines.</span>
Line 11: Line 11:
 
== Copy files what we need ==
 
== Copy files what we need ==
  
Copy node.js executable into your application folder.<br/>source can use [https://github.com/ADVANTECH-Corp/APIGateway/blob/master/node.exe https://github.com/ADVANTECH-Corp/APIGateway/blob/master/node.exe] or other version node.js
+
<span style="font-size:larger;">&lt;1&gt; Copy node.js executable into your application folder.<br/>source can use [https://github.com/ADVANTECH-Corp/APIGateway/blob/master/node.exe https://github.com/ADVANTECH-Corp/APIGateway/blob/master/node.exe] or other version node.js</span>
  
Copy node-windows into your node_modules folder. <br/>Source can use [https://github.com/ADVANTECH-Corp/APIGateway/tree/master/node_modules/node-windows https://github.com/ADVANTECH-Corp/APIGateway/tree/master/node_modules/node-windows]
+
<span style="font-size:larger;">&lt;2&gt; Copy node-windows into your node_modules folder.<br/>Source can use [https://github.com/ADVANTECH-Corp/APIGateway/tree/master/node_modules/node-windows https://github.com/ADVANTECH-Corp/APIGateway/tree/master/node_modules/node-windows]</span>
  
Copy following files to your application folder.
+
<span style="font-size:larger;">&lt;3&gt; Copy following files to your application folder.</span>
1. https://github.com/ADVANTECH-Corp/APIGateway/blob/master/install_apigw.bat
+
 
2. https://github.com/ADVANTECH-Corp/APIGateway/blob/master/uninstall_apigw.bat
+
#<span style="font-size:larger;">https://github.com/ADVANTECH-Corp/APIGateway/blob/master/install_apigw.bat<br/></span>
3. https://github.com/ADVANTECH-Corp/APIGateway/blob/master/install.js
+
#<span style="font-size:larger;">https://github.com/ADVANTECH-Corp/APIGateway/blob/master/uninstall_apigw.bat<br/></span>
4. https://github.com/ADVANTECH-Corp/APIGateway/blob/master/uninstall.js
+
#<span style="font-size:larger;">https://github.com/ADVANTECH-Corp/APIGateway/blob/master/install.js<br/></span>
 +
#<span style="font-size:larger;">https://github.com/ADVANTECH-Corp/APIGateway/blob/master/uninstall.js</span>
  
 
== Modify files to apply your application ==
 
== Modify files to apply your application ==
  
Modify install.js to change define.
+
<span style="font-size:larger;">&lt;1&gt; Modify install.js to change define.</span>
 
<pre>  name:'API-GW',
 
<pre>  name:'API-GW',
 
   description: 'API-GW',
 
   description: 'API-GW',
Line 29: Line 30:
 
</pre>
 
</pre>
  
Modify uninstall.js to change define.
+
<span style="font-size:larger;">&lt;2&gt; Modify uninstall.js to change define.</span>
 
<pre>  name:'API-GW',
 
<pre>  name:'API-GW',
 
   script: 'C:\\Program Files (x86)\\Advantech\\API-GW\\app.js'
 
   script: 'C:\\Program Files (x86)\\Advantech\\API-GW\\app.js'
 
</pre>
 
</pre>
  
Modify uninstall_apigw.bat to remove meta files created by your application in the runtime.
+
<span style="font-size:larger;">&lt;3&gt; Modify uninstall_apigw.bat to remove meta files created by your application in the runtime.</span>
  
*Add custom action in Advanced installer project.
+
<span style="font-size:larger;">&lt;4&gt; Add custom action in Advanced installer project.</span>
  
 
= Reference =
 
= Reference =

Revision as of 04:19, 15 November 2018

Introduction

This guidelines is aim to teach you how to run your Node.js application as a Windows service.

APIGateway, created by EdgeSense Team, can be running as a Windows Service, so we take it for example in this guidelines.

APIGateway is available at https://github.com/ADVANTECH-Corp/APIGateway

How to

Copy files what we need

<1> Copy node.js executable into your application folder.
source can use https://github.com/ADVANTECH-Corp/APIGateway/blob/master/node.exe or other version node.js

<2> Copy node-windows into your node_modules folder.
Source can use https://github.com/ADVANTECH-Corp/APIGateway/tree/master/node_modules/node-windows

<3> Copy following files to your application folder.

  1. https://github.com/ADVANTECH-Corp/APIGateway/blob/master/install_apigw.bat
  2. https://github.com/ADVANTECH-Corp/APIGateway/blob/master/uninstall_apigw.bat
  3. https://github.com/ADVANTECH-Corp/APIGateway/blob/master/install.js
  4. https://github.com/ADVANTECH-Corp/APIGateway/blob/master/uninstall.js

Modify files to apply your application

<1> Modify install.js to change define.

  name:'API-GW',
  description: 'API-GW',
  script: 'C:\\Program Files (x86)\\Advantech\\API-GW\\app.js',

<2> Modify uninstall.js to change define.

  name:'API-GW',
  script: 'C:\\Program Files (x86)\\Advantech\\API-GW\\app.js'

<3> Modify uninstall_apigw.bat to remove meta files created by your application in the runtime.

<4> Add custom action in Advanced installer project.

Reference