This post is in Draft Mode - it will not appear on the site or in search results

A node primer for C#/.NET Developers

-

Installation

Visual Studio

Install Visual Studio

Node

Install Node & Visual Studio Code (often called VSCode)

Project Setup

Visual Studio

File > New Project

or

dotnet new

.csproj file

Node

$ npm init -y

package.json

Dependency Management

Visual Studio

Uses nuget to bring in external dependencies

Nuget > Manage Packges

> nuget add package

pacakages.config

Node

Uses npm to bring in external dependencies

$ npm install core-js --save

The --save flag says to add it to your package.json

Writing Code (Print Hello World)

Visual Studio

Node

Running Code

Visual Studio

Node

$ node index.js

Or you can take scripts that you would run in bash and add them to your package.json scripts section like this:

"scripts": {
    "start": "node index.js"
}

And now we can tell npm to run our package like this:

$ npm run start

Debugging Code

Visual Studio

Attach to process

Debugging Code

launch.json

Referencing External Files

Visual Studio

Debugging Code

Object Oriented Programming

C#

JS

Summary