One of my previous side projects was to build a small web app meant to be run on enterprise Windows server environment. The type of place where software is still installed manually by clicking through an installer.
I wanted the app to run as a Windows service, and to have a minimal .msi -installer, so that more or less anyone could install the software.<p>Instead of being smart and writing the app in C# and get the full tooling of Microsoft... I choose to do a modern web app with Node.js and React.<p>I thought, how hard can it be to package it into a Windows service?<p>It turned out to be pretty hard. And not for any good reason, just a disparate ecosystem.<p>Finally, I managed to do a basic app and package it as an .msi, but all my creative energy to continue was gone.<p>To salvage a little of the project, I decided to upload a complete template app to Github (including build scripts). If someone wants to do the same thing, they just might save some time! The code is MIT licensed.<p>Three essential things I struggled with were:
- How to make the Node.js-app write local files (textfiles, SQLite..)
- Node.js interacting with the Windows service daemon
- Set up the service automatically when running the installer, including ARGV