Template for Mia Flow node live container.
Example of a simple Node.js 22 application with Fastify. It contains example of tests too.
To develop the service locally you need:
- Node 22+
To setup node, please if possible try to use nvm, so you can manage
multiple versions easily. Once you have installed nvm, you can go inside
the directory of the project and simply run nvm install, the .nvmrc file
will install and select the correct version if you don’t already have it.
Once you have all the dependency in place, you can launch:
npm installThis two commands, will install the dependencies and run the tests with
the coverage report that you can view as an HTML page in
coverage/lcov-report/index.html.
After running the coverage you can create your local copy of the default values
for the env variables needed for launching the application.
cp ./default.env ./local.envFrom now on, if you want to change anyone of the default values for
the variables you can do it inside the local.env file without
pushing it to the remote repository.
Once you have all your dependency in place you can launch:
set -a && source local.env
HTTP_PORT=6001 npm startAfter that you will have the service exposed on your machine. In order to verify that the service is working properly you could launch in another terminal shell:
curl http://localhost:6001/ciao