How to Develop Node.js in Windows Server - Windows ASP.NET Core Hosting 2024 | Review and ComparisonWindows ASP.NET Core Hosting 2024 | Review and Comparison

In previous article, we describe more about the advantages using Node.js. Now, we will continue about how to develop your application using Node.js. Node.js has been getting a lot of buzz these days. If you want easier to develop your application, then the post is right for you and stay tune in this post.

How Node.js Run on A Server?

Node.js works on a v8 environment – it is a virtual machine or a JavaScript engine that runs the JavaScript code, so for hosting you can’t use the ordinary web hosts. You will need the ones that have the v8 environment. Find more the provider that support Node.js on our blog.

Let’s Get Started

As we know that Node.js is working fine on Linux system. But, don’t worry, now Node.js can be run on Windows Server too. If your hosting provider use Plesk Control panel, then you can easily find this option on control panel and you can use Node.js.

image_1

For your information, we try to develop our Node.js on our Windows Server and we never install Node.js previously on this server. So, here are the steps

1. Install Node.js

Node.JS isn’t native on any environment, so to begin, let’s head over to  http://nodejs.org/, and install Node.JS for Windows.

image_2

Just click next until the installation complete.

Normally, if you are familiar with creating a .Net application, you create a new project/solution, write some code, or look at the sample, and hit play.

image_3

Well then

  • Clicking Node.js brings up a blank command prompt with a >
  • Clicking Node.Js command prompt brings up a command prompt

The next two link to documentation

2. Create Your Hello World

Let’s create your first project by creating your folder. Open your notepad and use this code

console.log("Hello World");

Ok, I have a file, hello.js, and inside I am writing Hello World to the console.

3. Execute the File

Perusing through the Node.JS documentation, I see that in order to execute a Node application, I open the Node.JS command prompt, navigate to my file, and type

node hello.js

4. Configure Notepad++

Notepad++ has tons of extra goodies, especially when you start adding plugins.

One such plugin I came across was NppExec, which allows you to execute commands/scripts within N++. Sounds like just what we need.

image_4

5. Done!

Great! We have Node installed, N++ is working as our editor, and we can execute using F5. It’s almost like being in VStudio!

Speaking of, if you are fortunate enough to have VStudio (Express version is free), then you can use the WebPlatform Installer to easily install and configure Visual Studio to start working with Node.JS. You can also use the Microsoft WebMatrix IDE