Notes from a Level 200 session by Nathan Totten. I'm live blogging from TechEd Australia...
Node.js is an open source/open framework built on Google’s Chrome engine.
All operations are essentially queued, and actioned by the single thread. ; The thread can’t afford to hang!
- Realtime comms/quick chatty interfaces
- REST interfaces
- JSON web services
- Client oriented web-apps/UI
Bad At (or not great at)
- Forms over CRUD (can be done, but maybe not the best choice)
- CPU intensive processing (don’t render media, images.. too intensive)
- Not a lot of standardization, different styles
- Clean API
- Simple concurrency model (is it concurrent??)
- Idle connections cost next to nothing
- Not a lot of standard framework inclusions
- No particular testing framework etc
- Young, still developing
- Bare metal.. not for the inexperienced.. not great IDE support etc
Node.js on Windows
Native build on Windows. ; Ported from Linux, can host Node processes on IIS with IISNode, which gives the benefits of IIS. ; Modules which work on other platforms will work on Windows. ; Contains package manager support from the commandline.
Node.js on IIS
- Process management
- Access to logs
- Side-by-side with other content
- Scalability on multi-core
- Minimal node code changes
- integrated management experience
Showing how to implement a HTTP server variable in Node.js script. ; Can be self hosted? ; Implements a web server (single threaded?). ; Command line tools written in Node.js. ; Windows Azure tools included.
Most Node.js/Windows Azure functionality can be developed without visiting the Azure control panel page. ; Supports inline GIT support – interesting. ; A bit of deployment pain as access is denied. ; Heading to the Azure Control Panel after all…
Using the command line to invoke the server side GIT repository to create the appropriate folders. This might be tough for non-GIT users to follow. TFS users looking baffled.
Packages being pulled down (like NuGet), but on the Azure server side. Site is now up and running. Deployment history is tracked on the Azure side. This allows rollback functionality. The GIT integration is quite nicely done. Somewhere Ted Buchan is grinning.
Deployments look pretty impressive, but a knowledge of GIT would be most handy.
There’s something called a NodeInspector. It runs in a web browser (but not Internet Explorer), so now we’re loading Google Chrome...ironic. It’s a matter of putting the Node server into debug mode.
NodeInspector...why does that remind me of Inspector Gadget? Go go Node [thing]!
Yes, you can also remote debug assuming the correct ports are opened.
Watches files for changes.. Otherwise, to void the cache, you’d have to restart the Node server. Installed as a package through command line: npm install node-inspector –g
Enables poling, web socket style functionality. Installs as per command line. Works on almost any browser, real-time communication requires long polling or web sockets.
As Azure is running currently on Windows Server 2008 R2, and that only IIS 8 (Server 2012) supports web sockets, as a consequence the current Node.js support in Azure needs to use long polling (as mentioned before). This will be changed...soon.
Head to github to find out more – this is open source stuff.
There are undoubtedly some interesting uses for this approach. It will be one to watch.