Ubuntu – How to create snappy nodejs web application

nodejssnapubuntu-corewebapps

Currently I'm working on IoT project, and we decided to use Beagle Bone Black. Original BBB OS use too much space and RAM so we googled and found Snappy Ubuntu Core as a perfect solution.

Problem is that I am new in Linux, and I find it hard to understand how snappy works, and where to start. This technology is relatively new, and I can't find tutorials, or books for absolute beginners.

So, I created NodeJs WebApp that runs on BBB for configuring and linking some inputs and outputs. Now I don't understand how to make snappy app of that, and run it on Snappy Ubuntu Core. I tried to write snapcraft.yaml file but I don't really understand what I need to put in the parts, or what parts really are. I just know everything can be a part :).

So, please can someone try to explain this to me like I'm a child, who grew up on Windows, and who knows NodeJS. I think it will be helpfull not only to me,but for many soon to be IoT developers.

Thank you

Best Answer

I'm picking up the replies in the comments to the question here.

snapcraft has a nodejs plugin which makes bundling very easy. You can pass node-packages which are then bundled with the app, using the standard package.json file will work too.

You can also specify node-engine which will define the version of nodejs you want the snap to run on.

A simple example of this can be found in the snapcraft code. Another one using grunt can be found in the snappy playpen.

Related Question