Hands On with NodeJS

JavaScript NodeJS
               http://phillydotnet.org/labs/20150304/

Philly.Net NodeJS event.

Rob Keiser started event and walked through how to setup and run NodeJS manually.  Why might you use NodeJS.  Light weight, Demo API’s, etc.. Some big companies are doing it.  Supposedly, you can use it within Azure if you want.

1.      Go to NodeJS and Install Node on your PC.  Recommended you Reboot once you install product.
               Install Project
2.      Used Subline Text for Editor (i.e. No Visual Studio in this Demo)

3.      Manually created files to start up a little webserver.  Rob walked through how to create different js files which started up the Server, do Routing, handle different URL requests, etc..  It was challenging to follow along as he was jumping between JS files and I was more concerned with getting at least some of it to work.

Below are some screen shots of a Working Demo, I have created to listen to requests on port 888 and write out to the console what URL’s you were hitting.  I stopped there. Feel free to try this yourself.
Create Server
Create Index
Create Router
Create RequestHandlers

             

 


Option #2 for trying NodeJS

Bill Wolff then started a Demo and used Visual Studio entirely for this work.  Much easier but It was actually good to do to it by hand first and I probably started to understand a little more about NodeNJ doing it myself.  Still, they didn’t a lot of background on NodeNJ and Why to use it. 

1.      Install Node.js Tool for Visual Studio
** This requires you to Install NodeJS first!! It still needs that to run the product.
2.      Make sure you install TypeScript 1.4 for Visual Studio 2013 as well.  I must not have had this installed as after I created my Project, it failed for it.  I installed TypeScript and then my project built fine.  Last month’s Philly.Net event was TypeScript so maybe everyone else already had it installed.
3.      Start Visual Studio
Create Multiple Projects and see how they work and are setup and work.  I recommend you do each on separate and run them in this example so you can review each site separately.
a.      Created Blank Node.JS Web Application
                                                              i.     Similar to Example Above.


b.      Created Basic Node.js Express 3 Application
                                                              i.      






c.      Created Starter Node.js Express 3 Application
                                                              i.     Great Website Example.  3-4 pages, Responsive design with Bootstrap, router pages, etc..







See Websites within Visual Studio


See Starter Express Application running below.  NodeNJ still runs as you can see as that is listening for the page requests.  Views use .jade extensions.  Jade is the Rendering engine, similar to Razor for MVC views.


Comments

Popular posts from this blog

Intro to MongoDB

Starting our .NET Core WebAPI Journey – Step 2