Skip to content

luizcarlosfaria/generator-node-api-docker-1st-class-experience

Repository files navigation

generator-node-api-docker-1st-class-experience NPM version Build Status Coverage percentage Downloads Downloads Downloads Downloads

Greenkeeper badge

NodeJS + Typescript + TSLint + Restify + MongoDB + Docker, With VS Code Automation = VSCode TypeScript Live Debug with Containers

Installation

First, install Yeoman and generator-node-api-docker-1st-class-experience using npm (we assume you have pre-installed node.js).

npm install -g yo generator-node-api-docker-1st-class-experience

Then generate your new project:

  1. Create a new folder.

  2. Run yo node-api-docker-1st-class-experience

  3. Open VSCode code .

  4. Put a breakpoint at line 21 of ./src/server.ts

  5. Just press F5 key (The first launch task uses docker to debug, you have other two options to debug in launch dropdown)

The 1st class experience with NodeJS, Typescript, Docker

  • A NodeJS API with TypeScript, TSLint, Restify, MongoDB.
  • Using VSCode you will be able to:
    • Use VSCode to debug TypeScript based NodeJS application locally (using Local debug debug configuration).
    • Use VSCode to build and debug the TypeScript based NodeJS application behind the docker container with Docker Compose (using Docker debug debug configuration).
    • Use VSCode to build and debug with live reload of the TypeScript based NodeJS application behind the docker container with Docker Compose (using [docker] build-and-watch VSCode task and Docker + watch debug debug configuration).
  • With docker you will be able to:
    • v3 based docker-compose.yml.
    • The build is two-phase based, to get packages separately of application build.
    • Execute docker-compose up command to create a production ready deployment.
    • MongoDB container will be created side-by-side with your aplication, automatically, secured by authentication.
  • VSCode Integration
    • 3 debug options.
    • 5 VSCode tasks (including build task) to perform all necessary operations to manage, debug and build with docker.
    • TSLint with autofix enabled on VSCode and Build.
    • Use status-bar-tasks Status Bar Tasks VSCode plugin to see all tasks on status bar or use Tasks: Run Task with pressing Ctrl+p >

Notes

  • Local build will run in 2 seconds.
  • First docker build is a full build and will during 3 minutes or more (depending on your connection speed).
  • Every next build will run in seconds (
  • Only changes in below files will demand a full build:
    • package-lock.json
    • package.json
    • tsconfig.json
    • tslint.json
    • typings.json

License

MIT © Luiz Carlos Faria made in brazil