Skip to content

Repository files navigation

demo-node

Summary

Template for Mia Flow node live container.

Example of a simple Node.js 22 application with Fastify. It contains example of tests too.

Local Development

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 install

This 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.env

From 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 start

After 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

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages