Skip to content

vtex-apps/starter.node-service

Repository files navigation

Node Service Starter for VTEX IO apps

This repository is used to generate a boilerplate to implement a VTEX IO service with Node.js HTTP handler.

How to use it

⚠️ vtex init is not integrated with this template yet. Meanwhile, you can download the code directly from the repository

  1. Install VTEX IO CLI
  2. Run the command vtex init to create an app, and follow the instructions to add a Node.js service in the app

It will create a project folder for the new app and add the Node.js service into it. Once the service is created, you can modifying it as you like.

How does it work

VTEX IO runs the service as a container. A Dockerfile to build the container image is provided by the starter, and it will be used by VTEX IO engine to build the image.

You can modify anything that is provided by default in the boilerplate, including the Dockerfile.

Features

The generated boilerplate comes with best practices for creating VTEX IO Node.js services:

Scripts

Following scripts are available to be used with yarn:

  • yarn build - Builds the service generating final files in the dist folder. This will use tsc to convert the TypeScript files to pure JavaScript
  • yarn start - Builds the service and start it on localhost in prodution� mode
  • yarn dev - Builds the service and start it service on localhost in development� mode
  • yarn watch - Starts the service on localhost with nodemon and ts-node, and automatically restarts the server when src files are changed
  • yarn debug - Starts the service on localhost ready for debugging the execution
  • yarn test - Runs tests from src/__tests__ with jest
  • yarn lint - Lints and formats the code

Recipes

// TODO

Telemetry

// TODO