Node.js application as Windows service

From ESS-WIKI
Revision as of 04:15, 15 November 2018 by Sam35.lin (talk | contribs) (first draft)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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

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

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

Copy following files to your application folder. https://github.com/ADVANTECH-Corp/APIGateway/blob/master/install_apigw.bat https://github.com/ADVANTECH-Corp/APIGateway/blob/master/uninstall_apigw.bat https://github.com/ADVANTECH-Corp/APIGateway/blob/master/install.js https://github.com/ADVANTECH-Corp/APIGateway/blob/master/uninstall.js

Modify files to apply your application

Modify install.js to change define.

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

Modify uninstall.js to change define.

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

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

  • Add custom action in Advanced installer project.

Reference