Backend Node (be-node-express)

Purpose of this quickstarter (use this when you want to …​)

This is a node (v6) quick starter with express using Typescript. If you are doing non-blocking operation and does not have heavy algorithm/Job which consumes lots of CPU power, this could be an ideal fit. It contains the basic setup for Docker, Jenkins, SonarQube and OpenShift.

What files / architecture is generated?

The files are generated using a yeoman generator for node-express-typescript. Generated files include a minimal express server with dummy routes.

├── Jenkinsfile - Contains Jenkins build configuration
├── docker - Contains Dockerfile for the build
│   └── Dockerfile
├── package-lock.json - Commit this file as well when you update your dependencies
├── package.json - This file contains all the npm dependencies and build commands for the project.
├──  - SonarQube Configuration
├── src
│   ├── greeter.ts
│   ├── index.ts -  Entrypoint, This runs first
│   └── routes
│       └── weather.ts
├── test
│   ├── greeter-spec.ts
│   └── index-spec.ts
├── tsconfig.json - TypeScript Configuration file
└── tslint.json - TypeScript Linter Configuration
4 directories, 14 files

Frameworks used

  1. Express (^4.15)

  2. Mocha & Chai for Unit Testing

  3. Typescript

Usage - how do you start after you provisioned this quickstarter

  1. Do a npm install form the project root to install all the dependencies.

  2. npm run serve will transpile the code and start the server

  3. Execute npm run test for unit testing

How this quickstarter is built thru jenkins

The build pipeline is defined in the Jenkinsfile in the project root. The mains stages of the pipeline are,

  1. Build : npm run build command will be executed to build the application and then the build (including the node_modules) will be copied to the docker/dist folder.

  2. Unit Testing : npm test -- --progress false & npm run coverage commands will be executed for running unit tests and to generate coverage report. The results can be seen form the Jenkins console output.

Builder Slave used

This quickstarter uses Nodejs10-Angular builder slave Jenkins builder slave.

Known limitations