Building snap package for on node.js project

Hi,

First, I’m novice in snap/snapcraft environment and so, please, be patient with my questions :wink:

I’m trying to build snap package from my node.js based project (project correctly working on Ubuntu Linux, started from project root directory by command “node index”), using snapcraft.yaml in root of my project

name: wgbe
version: git
summary: Web GUI back-end.
description: |
  Start wgbe like HTTP server at port 3081
    $ wgbe
confinement: devmode
base: core20

apps:
  daemon:
    command: bin/node index
    daemon: simple

aipt2-wgbe:
  command: bin/node index

parts:
  aipt2-wgbe:
  plugin: dump
    source: .

node:
  plugin: npm
  npm-node-version: "14.17.0"
  source: .

Using snapcraft --destructive-node the .snap package is successfully created (running in VBox where I cannot enable VM for multipass).

During building there was problem with Readme.md present in node.js and also in my project, so I have solved by renaming my project Readme.md to Readme_WGBE.md (temporary).

Then I install it locally on the same machine using command

sudo snap install wgbe_v0007+git547.2f39284-dirty_amd64.snap --devmode --dangerous

It was successfully installed into the directory /snap/wgbe/current or /snap/wgbe/x1.

However in log (checking via journalctl -u snap.wgbe.daemon --follow) I can see that daemon started during snap start searches the index file (from daemon command /bin/node index) in directory /var/snap/wgbe/current (or x1?) and so daemon isn’t started correctly.

Is there any way how to enforce snap to search index file in the project directory /snap/wgbe/current and not in /var/snap/wgbe/current ?

Or is there anything what I can improve in this handling of my project? For sure it is :wink:

I would appreciate any comments.