Ugo Lattanzi gave a presentation on Node.js for .NET developers and vice versa. He began by explaining what Node.js is and its advantages like being fast, lightweight and suitable for real-time applications. He then demonstrated how to build a basic web application using Express.js and the template engine Vash, which is similar to Razor. He also discussed database options, validation, middleware, and Edge.js for connecting Node.js and .NET applications. Slides and demos from the presentation would be available on his website in the following days.
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Nodejs for .NET web developers
1. MILAN november 28th/29th 2014 - @imperugo
Ugo Lattanzi
NodeJs for .NET Web developers and vice versa:
Meet the Dark Side of development
Head of Technologies at Gaia (http://gaia.is.it)
@imperugo
imperugo@gmail.com
http://tostring.it
2. MILAN november 28th/29th 2014 – Ugo Lattanzi
What is node?
Node.js® is a platform built on Chrome's JavaScript runtime for easily
building fast, scalable network applications. Node.js uses an event-driven,
non-blocking I/O model that makes it lightweight and efficient,
perfect for data-intensive real-time applications that run across
distributed devices.
3. MILAN november 28th/29th 2014 – Ugo Lattanzi
What can I do with
Node?
Http, networking, Websockets but also it is an invaluable tool for
developers
4. MILAN november 28th/29th 2014 – Ugo Lattanzi
Why is it so cool?
it’s javascript
it’s fast
optimised (low resources)
runs everywhere
6. MILAN november 28th/29th 2014 – Ugo Lattanzi
everybody loves it …
except Ted Dziuba, he defined “Node Js a cancer”
http://teddziuba.com/2011/10/node-js-is-cancer.html
(post removed)
7. MILAN november 28th/29th 2014 – Ugo Lattanzi
Node vs .NET
IIS => Node.exe
C# / VB => Javascript
NuGet => npm
ASP.NET WebForm => Express + EJS
ASP.NET MVC => Express + Vash
ASP.NET WebAPI => Express
SignalR => Socket.io
8. MILAN november 28th/29th 2014 – Ugo Lattanzi
Visual Studio
addicted?
don’t worry, there is a free and open source plugin (NTVS) that turns
Visual Studio into a Node.js IDE
http://nodejstools.codeplex.com/
NTVS supports Editing, Intellisense, Profiling, npm, TypeScript,
Debugging locally and remotely (Windows/MacOS/Linux), as well as
Azure Web Sites and Cloud Service.
14. MILAN november 28th/29th 2014 – Ugo Lattanzi
express.js
npm init
npm install express —save
npm install vash —save
15. MILAN november 28th/29th 2014 – Ugo Lattanzi
express.js
package.json is the same thing of packages.config in nuget and npm
install restore the missing packages
20. MILAN november 28th/29th 2014 – Ugo Lattanzi
vash (@razor)
Vash is a template engine that offers a swift flow between code and
content using Razor Syntax
it supports master pages, partial, helpers and so on
it isn’t a porting of Razor View Engine but is very similar
the file extension for the views is .vash
22. MILAN november 28th/29th 2014 – Ugo Lattanzi
vash (@razor)
partials are simple html files in the view folder
to include a partial in your view all you have to do is
@html.include(‘name_of_the_partial’)
28. MILAN november 28th/29th 2014 – Ugo Lattanzi
express.js
(validation)
there isn't data annotation so validation is more "challenging" than .net
express-validator is a cool middleware for Express.Js that helps you to
validate input data
npm install express-validator —save
31. MILAN november 28th/29th 2014 – Ugo Lattanzi
database
of course you can use MS Sql Server (npm install mssql —save)
but
MongoDb “could be better” with Node (npm install mongodb —save)
34. MILAN november 28th/29th 2014 – Ugo Lattanzi
edge.js
An edge connects two nodes. This edge connects Node.js and .NET. V8
and CLR/Mono - in process. On Windows, MacOS, and Linux.