Node.js
  • 25 Jan 2023
  • 2 Minutes to read
  • Dark
    Light
  • PDF

Node.js

  • Dark
    Light
  • PDF

Building Node.js Applications

Node.js is a JavaScript runtime environment that allows developers to build various types of applications, from console utilities to server-side web applications written in JavaScript. JavaScript has evolved from a client-side scripting language applicable only within HTML to a full-fledged development language that spans multiple layers. Node applications can be developed using a variety of IDEs, from simple text editors to Atom to VSCode. Node is the language referred to as the "N" part of a MEAN development/deployment stack (MongoDB, Express, Angular, Node) that can be used to quickly build dynamic websites.

Building Node.js Applications

Since JavaScript is an interpreted language, compilation in the traditional sense of C/C++ isn't required. However, there are several languages that can be transpiled to JavaScript, including CoffeeScript, Dart, TypeScript, etc. In addition, there are several productivity tools that can be run to turn raw source code into the building blocks of an application:

  • Babel - converts modern JS into backward-compatible JS code to run newer features on older platforms
  • Broccoli - a JS build tool that packages resources (images, CSS, JS, etc.) into a distributable form
  • Webpack - a JS bundler that handles both applications/libraries (.js) and assets (images/fonts/stylesheets)
  • JSLint - static analysis tool for JS applications
  • TypeScript - a language developed by Microsoft that transpiles into JS
  • Grunt - a task runner based on JS to automate common build or other repetitive tasks when developing JS applications
  • Mocha - a JS unit test runner

These tools are run as a series of command-line operations, commonly as part of a build script.

Deploying Node.js Application

Usually, Node applications are deployed in one of the following ways:

  • packaged into containers, then deploying the container to a cloud host such as AWS, Azure, or Google Cloud
  • deployed directly to Apache or nginx if using the web framework Express
  • published to Platform-as-a-Service providers such as Heroku

The publish process involves little more than copying files. In BuildMaster's case, using the Deploy-Artifact operation is the simplest method to deploy Node.js applications.

Package Management with npm

Most useful Node.js features are provided by library packages provided by npm.
Private registries (such as ProGet) can also be used for an additional layer of reliability and security.

Automation with BuildMaster

See it live! The ProfitCalc Node.js Sample is available when creating a new application in your own instance of BuildMaster.

Because Node.js applications are built with a variety of console tools, it's as simple as running a series of Exec operations in a build plan that follows the general format:

  • Install npm packages
  • Lint the source
  • Transpile source code
  • Run unit tests or static analysis
  • Capture artifact or package into container

Other tools (such as the ones listed earlier) can be run following depending on your organization's requirements. After these tools are run, build output is usually some form of copyable code and the output can be captured into a build artifact or packaged into a container to be deployed in future pipeline stages.


Was this article helpful?