SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Sasha Goldshtein
CTO, SELA Group

@goldshtn
blog.sashag.net

JavaScript, Meet Cloud:
Node.js on Windows Azure

© Copyright SELA Software & Education Labs Ltd. | 14-18 Baruch Hirsch St Bnei Brak, 51202 Israel | www.selagroup.com
Node.js?
Lightweight JavaScript
server with a rich module
ecosystem running on
Azure as a web site or a
service
The New Microsoft
You can run a Node.js web service on an Ubuntu
VM on Windows Azure that uses Redis for
caching, MongoDB for sessions, and an SQL
Database for most models. Oh, and you can
integrate it with a Windows Store or iPhone app.
What is Node.js
JavaScript on the server
Uses the Google V8 engine
High-speed JavaScript JIT and GC

Hundreds of modules, vibrant ecosystem
Package manager, including dependencies
HTTP(S), TCP, UDP server and client
Bindings and ORMs for virtually every DB
MVC framework (express)

Everything is open source
Why Node?
Cross-platform
It’s the next hip thing (after RoR)
Asynchronous but no explicit concurrency
Rapid development
Tiny footprint
Hello, Node
var http = require('http');
var server = http.createServer(function(req, res) {
res.writeHead(200,
{'Content-Type’: 'text/plain'});
res.end('Hello, Node!n');
});
server.listen(8080);
express
var express = require('express');
var app = express.createServer();
app.get('/hello', function (req, res) {
res.sendfile('hello.htm');
});

app.post('/echo', function (req, res) {
res.end('You said: ' + req.body.message);
});
app.listen(8080);
nstore
var nstore = require('nstore');
var messages = nstore.new('messages.db', ...);
messages.save(msg.id, msg, function (err) ...);
messages.all(function (err, results) {
...
});
messages.find({ user: 'Sasha' }, ...);
Node on Azure Web Sites
Put your code in app.js or server.js
Deploy using
Git, Mercurial, TFS, FTP, WebDeploy, Dropbox
Use modules freely with package.json
Debug your website with node-inspectorNEW
msnodesql
var sql = require('msnodesql');
sql.query(conn_str, 'SELECT * FROM Messages',
function (err, results) {
if (!err) ...
}
);
sql.queryRaw(conn_str, 'INSERT INTO Messages ...');
Node with SQL Database
Create an SQL database
Get a connection string
Open the firewall (if testing from premises)
Node away!
Shared DB with Mobile Services
While we’re at it 

Windows Azure Mobile Services makes
implementing backends a breeze
You can share a DB
var table = MobileService.GetTable<Message>();
var messages = table.Where(
m => m.User == "Sasha").ToList();
await table.InsertAsync(new Message(...));
Node with Table Storage
Windows Azure Table Storage is a
lightweight, super-cheap, NoSQL data store
Rows have dynamic properties
Single primary key (index)
var q = azure.TableQuery.select().from('messages');
tableService.queryEntities(
q, function (err, results) ...);
tableService.insertEntity('messages', newMsg, ...);
Node on Azure Virtual Machines
Install whatever you want
Pick from Windows or Linux distros
Microsoft open VMDepot offers dozens of images

We’ll use MongoDB on Ubuntu
And Mongoose for an ORM
var db = mongoose.createConnection(...);
var Message = db.model('Message', schema);
Message.find(function (err, results) ...);
Node Editor in The Cloud
Visual Studio Online “Monaco”NEW is a cloud
IDE for your Node/ASP.NET Azure web sites
Questions
Sasha Goldshtein
CTO, SELA Group

@goldshtn
blog.sashag.net

Weitere Àhnliche Inhalte

Was ist angesagt?

JavaScript is the new black - Why Node.js is going to rock your world - Web 2...
JavaScript is the new black - Why Node.js is going to rock your world - Web 2...JavaScript is the new black - Why Node.js is going to rock your world - Web 2...
JavaScript is the new black - Why Node.js is going to rock your world - Web 2...
Tom Croucher
 
OpenStack Nova + Quantum Demo
OpenStack Nova + Quantum DemoOpenStack Nova + Quantum Demo
OpenStack Nova + Quantum Demo
Dan Wendlandt
 
MongoDB on Azure - Tips, Tricks and Examples
MongoDB on Azure - Tips, Tricks and ExamplesMongoDB on Azure - Tips, Tricks and Examples
MongoDB on Azure - Tips, Tricks and Examples
MongoDB
 
ĐŸĐŸŃŃ‚Ń€ĐŸĐ”ĐœĐžĐ” ĐżŃ€ĐŸŃŃ‚ĐŸĐłĐŸ REST сДрĐČДра ĐœĐ° Node.js | Odessa Frontend Code challenge
ĐŸĐŸŃŃ‚Ń€ĐŸĐ”ĐœĐžĐ” ĐżŃ€ĐŸŃŃ‚ĐŸĐłĐŸ REST сДрĐČДра ĐœĐ° Node.js | Odessa Frontend Code challengeĐŸĐŸŃŃ‚Ń€ĐŸĐ”ĐœĐžĐ” ĐżŃ€ĐŸŃŃ‚ĐŸĐłĐŸ REST сДрĐČДра ĐœĐ° Node.js | Odessa Frontend Code challenge
ĐŸĐŸŃŃ‚Ń€ĐŸĐ”ĐœĐžĐ” ĐżŃ€ĐŸŃŃ‚ĐŸĐłĐŸ REST сДрĐČДра ĐœĐ° Node.js | Odessa Frontend Code challenge
OdessaFrontend
 

Was ist angesagt? (20)

Node js Global Packages
Node js Global PackagesNode js Global Packages
Node js Global Packages
 
Node js
Node jsNode js
Node js
 
Minio scale 15 x
Minio scale 15 xMinio scale 15 x
Minio scale 15 x
 
Node in Real Time - The Beginning
Node in Real Time - The BeginningNode in Real Time - The Beginning
Node in Real Time - The Beginning
 
Intro to Node.js
Intro to Node.jsIntro to Node.js
Intro to Node.js
 
dba_lounge_Iasi: Everybody likes redis
dba_lounge_Iasi: Everybody likes redisdba_lounge_Iasi: Everybody likes redis
dba_lounge_Iasi: Everybody likes redis
 
RelStorage Plone Zope RDB Storage Backend
RelStorage Plone Zope RDB Storage BackendRelStorage Plone Zope RDB Storage Backend
RelStorage Plone Zope RDB Storage Backend
 
Node js beginner
Node js beginnerNode js beginner
Node js beginner
 
Doing Dropbox the Native Cloud Native Way
Doing Dropbox the Native Cloud Native WayDoing Dropbox the Native Cloud Native Way
Doing Dropbox the Native Cloud Native Way
 
MinIO January 2020 Briefing
MinIO January 2020 BriefingMinIO January 2020 Briefing
MinIO January 2020 Briefing
 
JavaScript is the new black - Why Node.js is going to rock your world - Web 2...
JavaScript is the new black - Why Node.js is going to rock your world - Web 2...JavaScript is the new black - Why Node.js is going to rock your world - Web 2...
JavaScript is the new black - Why Node.js is going to rock your world - Web 2...
 
Node js
Node jsNode js
Node js
 
Going Serverless
Going Serverless Going Serverless
Going Serverless
 
Getting serious \w private kubernetes clusters &amp; cloud native storage
Getting serious \w private kubernetes clusters &amp; cloud native storageGetting serious \w private kubernetes clusters &amp; cloud native storage
Getting serious \w private kubernetes clusters &amp; cloud native storage
 
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJS
 
OpenStack Nova + Quantum Demo
OpenStack Nova + Quantum DemoOpenStack Nova + Quantum Demo
OpenStack Nova + Quantum Demo
 
MongoDB on Azure - Tips, Tricks and Examples
MongoDB on Azure - Tips, Tricks and ExamplesMongoDB on Azure - Tips, Tricks and Examples
MongoDB on Azure - Tips, Tricks and Examples
 
ĐŸĐŸŃŃ‚Ń€ĐŸĐ”ĐœĐžĐ” ĐżŃ€ĐŸŃŃ‚ĐŸĐłĐŸ REST сДрĐČДра ĐœĐ° Node.js | Odessa Frontend Code challenge
ĐŸĐŸŃŃ‚Ń€ĐŸĐ”ĐœĐžĐ” ĐżŃ€ĐŸŃŃ‚ĐŸĐłĐŸ REST сДрĐČДра ĐœĐ° Node.js | Odessa Frontend Code challengeĐŸĐŸŃŃ‚Ń€ĐŸĐ”ĐœĐžĐ” ĐżŃ€ĐŸŃŃ‚ĐŸĐłĐŸ REST сДрĐČДра ĐœĐ° Node.js | Odessa Frontend Code challenge
ĐŸĐŸŃŃ‚Ń€ĐŸĐ”ĐœĐžĐ” ĐżŃ€ĐŸŃŃ‚ĐŸĐłĐŸ REST сДрĐČДра ĐœĐ° Node.js | Odessa Frontend Code challenge
 
React Hooks by Oleksandr Oleksiv Scalac
React Hooks by Oleksandr Oleksiv ScalacReact Hooks by Oleksandr Oleksiv Scalac
React Hooks by Oleksandr Oleksiv Scalac
 
Codemotion Amsterdam 2016 - Building microservices with Vert.x
Codemotion Amsterdam 2016 - Building microservices with Vert.xCodemotion Amsterdam 2016 - Building microservices with Vert.x
Codemotion Amsterdam 2016 - Building microservices with Vert.x
 

Andere mochten auch

Andere mochten auch (7)

Node.js Build, Deploy and Scale Webinar
Node.js Build, Deploy and Scale WebinarNode.js Build, Deploy and Scale Webinar
Node.js Build, Deploy and Scale Webinar
 
Node.js on microsoft azure april 2014
Node.js on microsoft azure april 2014Node.js on microsoft azure april 2014
Node.js on microsoft azure april 2014
 
Node.js X Windows Azure
Node.js X Windows AzureNode.js X Windows Azure
Node.js X Windows Azure
 
Node.js on Windows Azure
Node.js on Windows AzureNode.js on Windows Azure
Node.js on Windows Azure
 
Develop & Deploy Node.js app on Windows Azure
Develop & Deploy Node.js app on Windows AzureDevelop & Deploy Node.js app on Windows Azure
Develop & Deploy Node.js app on Windows Azure
 
Varna conf nodejs-oss-microsoft-azure[final]
Varna conf nodejs-oss-microsoft-azure[final]Varna conf nodejs-oss-microsoft-azure[final]
Varna conf nodejs-oss-microsoft-azure[final]
 
Building Your First Node.js App and Publishing to Azure
Building Your First Node.js App and Publishing to AzureBuilding Your First Node.js App and Publishing to Azure
Building Your First Node.js App and Publishing to Azure
 

Ähnlich wie JavaScript, Meet Cloud: Node.js on Windows Azure

Node.js Web Development .pdf
Node.js Web Development .pdfNode.js Web Development .pdf
Node.js Web Development .pdf
Abanti Aazmin
 
ZK MVVM, Spring & JPA On Two PaaS Clouds
ZK MVVM, Spring & JPA On Two PaaS CloudsZK MVVM, Spring & JPA On Two PaaS Clouds
ZK MVVM, Spring & JPA On Two PaaS Clouds
Simon Massey
 
Azure Cloud Dev Camp - App Platform
Azure Cloud Dev Camp - App PlatformAzure Cloud Dev Camp - App Platform
Azure Cloud Dev Camp - App Platform
giventocode
 
KSDG 4th event: Windows Azure Session
KSDG 4th event: Windows Azure SessionKSDG 4th event: Windows Azure Session
KSDG 4th event: Windows Azure Session
Jeff Chu
 

Ähnlich wie JavaScript, Meet Cloud: Node.js on Windows Azure (20)

Azure Camp Bandung
Azure Camp BandungAzure Camp Bandung
Azure Camp Bandung
 
Node js Introduction
Node js IntroductionNode js Introduction
Node js Introduction
 
Windows Azure
Windows AzureWindows Azure
Windows Azure
 
Public Cloud Platforms for .NET Developers
Public Cloud Platforms for .NET DevelopersPublic Cloud Platforms for .NET Developers
Public Cloud Platforms for .NET Developers
 
Microsoft Azure
Microsoft AzureMicrosoft Azure
Microsoft Azure
 
Node.js Web Development .pdf
Node.js Web Development .pdfNode.js Web Development .pdf
Node.js Web Development .pdf
 
ZK MVVM, Spring & JPA On Two PaaS Clouds
ZK MVVM, Spring & JPA On Two PaaS CloudsZK MVVM, Spring & JPA On Two PaaS Clouds
ZK MVVM, Spring & JPA On Two PaaS Clouds
 
Azure Cloud Dev Camp - App Platform
Azure Cloud Dev Camp - App PlatformAzure Cloud Dev Camp - App Platform
Azure Cloud Dev Camp - App Platform
 
Node js
Node jsNode js
Node js
 
NoSQL on microsoft azure april 2014
NoSQL on microsoft azure   april 2014NoSQL on microsoft azure   april 2014
NoSQL on microsoft azure april 2014
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jiban
 
KSDG 4th event: Windows Azure Session
KSDG 4th event: Windows Azure SessionKSDG 4th event: Windows Azure Session
KSDG 4th event: Windows Azure Session
 
Vijay Oscon
Vijay OsconVijay Oscon
Vijay Oscon
 
Drupal DevOps on Microsoft Azure Websites
Drupal DevOps on Microsoft Azure WebsitesDrupal DevOps on Microsoft Azure Websites
Drupal DevOps on Microsoft Azure Websites
 
SPT15 To the Cloud! Utilizing AWS and Azure as Cloud Hosting Providers for Sh...
SPT15 To the Cloud! Utilizing AWS and Azure as Cloud Hosting Providers for Sh...SPT15 To the Cloud! Utilizing AWS and Azure as Cloud Hosting Providers for Sh...
SPT15 To the Cloud! Utilizing AWS and Azure as Cloud Hosting Providers for Sh...
 
Nodejs
NodejsNodejs
Nodejs
 
Create Restful Web Application With Node.js Express Framework
Create Restful Web Application With Node.js Express FrameworkCreate Restful Web Application With Node.js Express Framework
Create Restful Web Application With Node.js Express Framework
 
AWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for GovernmentAWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for Government
 
The Happy Path: Migration Strategies for Node.js
The Happy Path: Migration Strategies for Node.jsThe Happy Path: Migration Strategies for Node.js
The Happy Path: Migration Strategies for Node.js
 
20141021 AWS Cloud Taekwon - Startup Best Practices on AWS
20141021 AWS Cloud Taekwon - Startup Best Practices on AWS20141021 AWS Cloud Taekwon - Startup Best Practices on AWS
20141021 AWS Cloud Taekwon - Startup Best Practices on AWS
 

Mehr von Sasha Goldshtein

The Next Linux Superpower: eBPF Primer
The Next Linux Superpower: eBPF PrimerThe Next Linux Superpower: eBPF Primer
The Next Linux Superpower: eBPF Primer
Sasha Goldshtein
 
Staring into the eBPF Abyss
Staring into the eBPF AbyssStaring into the eBPF Abyss
Staring into the eBPF Abyss
Sasha Goldshtein
 

Mehr von Sasha Goldshtein (20)

Modern Linux Tracing Landscape
Modern Linux Tracing LandscapeModern Linux Tracing Landscape
Modern Linux Tracing Landscape
 
The Next Linux Superpower: eBPF Primer
The Next Linux Superpower: eBPF PrimerThe Next Linux Superpower: eBPF Primer
The Next Linux Superpower: eBPF Primer
 
Staring into the eBPF Abyss
Staring into the eBPF AbyssStaring into the eBPF Abyss
Staring into the eBPF Abyss
 
Visual Studio 2015 and the Next .NET Framework
Visual Studio 2015 and the Next .NET FrameworkVisual Studio 2015 and the Next .NET Framework
Visual Studio 2015 and the Next .NET Framework
 
Swift: Apple's New Programming Language for iOS and OS X
Swift: Apple's New Programming Language for iOS and OS XSwift: Apple's New Programming Language for iOS and OS X
Swift: Apple's New Programming Language for iOS and OS X
 
C# Everywhere: Cross-Platform Mobile Apps with Xamarin
C# Everywhere: Cross-Platform Mobile Apps with XamarinC# Everywhere: Cross-Platform Mobile Apps with Xamarin
C# Everywhere: Cross-Platform Mobile Apps with Xamarin
 
Modern Backends for Mobile Apps
Modern Backends for Mobile AppsModern Backends for Mobile Apps
Modern Backends for Mobile Apps
 
.NET Debugging Workshop
.NET Debugging Workshop.NET Debugging Workshop
.NET Debugging Workshop
 
Performance and Debugging with the Diagnostics Hub in Visual Studio 2013
Performance and Debugging with the Diagnostics Hub in Visual Studio 2013Performance and Debugging with the Diagnostics Hub in Visual Studio 2013
Performance and Debugging with the Diagnostics Hub in Visual Studio 2013
 
Mastering IntelliTrace in Development and Production
Mastering IntelliTrace in Development and ProductionMastering IntelliTrace in Development and Production
Mastering IntelliTrace in Development and Production
 
Introduction to RavenDB
Introduction to RavenDBIntroduction to RavenDB
Introduction to RavenDB
 
State of the Platforms
State of the PlatformsState of the Platforms
State of the Platforms
 
Delivering Millions of Push Notifications in Minutes
Delivering Millions of Push Notifications in MinutesDelivering Millions of Push Notifications in Minutes
Delivering Millions of Push Notifications in Minutes
 
Building Mobile Apps with a Mobile Services .NET Backend
Building Mobile Apps with a Mobile Services .NET BackendBuilding Mobile Apps with a Mobile Services .NET Backend
Building Mobile Apps with a Mobile Services .NET Backend
 
Building iOS and Android Apps with Mobile Services
Building iOS and Android Apps with Mobile ServicesBuilding iOS and Android Apps with Mobile Services
Building iOS and Android Apps with Mobile Services
 
Task and Data Parallelism
Task and Data ParallelismTask and Data Parallelism
Task and Data Parallelism
 
What's New in C++ 11?
What's New in C++ 11?What's New in C++ 11?
What's New in C++ 11?
 
Attacking Web Applications
Attacking Web ApplicationsAttacking Web Applications
Attacking Web Applications
 
Windows Azure Mobile Services
Windows Azure Mobile ServicesWindows Azure Mobile Services
Windows Azure Mobile Services
 
First Steps in Android Development
First Steps in Android DevelopmentFirst Steps in Android Development
First Steps in Android Development
 

KĂŒrzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

KĂŒrzlich hochgeladen (20)

Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

JavaScript, Meet Cloud: Node.js on Windows Azure

  • 1. Sasha Goldshtein CTO, SELA Group @goldshtn blog.sashag.net JavaScript, Meet Cloud: Node.js on Windows Azure © Copyright SELA Software & Education Labs Ltd. | 14-18 Baruch Hirsch St Bnei Brak, 51202 Israel | www.selagroup.com
  • 2. Node.js? Lightweight JavaScript server with a rich module ecosystem running on Azure as a web site or a service
  • 3. The New Microsoft You can run a Node.js web service on an Ubuntu VM on Windows Azure that uses Redis for caching, MongoDB for sessions, and an SQL Database for most models. Oh, and you can integrate it with a Windows Store or iPhone app.
  • 4. What is Node.js JavaScript on the server Uses the Google V8 engine High-speed JavaScript JIT and GC Hundreds of modules, vibrant ecosystem Package manager, including dependencies HTTP(S), TCP, UDP server and client Bindings and ORMs for virtually every DB MVC framework (express) Everything is open source
  • 5. Why Node? Cross-platform It’s the next hip thing (after RoR) Asynchronous but no explicit concurrency Rapid development Tiny footprint
  • 6. Hello, Node var http = require('http'); var server = http.createServer(function(req, res) { res.writeHead(200, {'Content-Type’: 'text/plain'}); res.end('Hello, Node!n'); }); server.listen(8080);
  • 7. express var express = require('express'); var app = express.createServer(); app.get('/hello', function (req, res) { res.sendfile('hello.htm'); }); app.post('/echo', function (req, res) { res.end('You said: ' + req.body.message); }); app.listen(8080);
  • 8. nstore var nstore = require('nstore'); var messages = nstore.new('messages.db', ...); messages.save(msg.id, msg, function (err) ...); messages.all(function (err, results) { ... }); messages.find({ user: 'Sasha' }, ...);
  • 9. Node on Azure Web Sites Put your code in app.js or server.js Deploy using Git, Mercurial, TFS, FTP, WebDeploy, Dropbox Use modules freely with package.json Debug your website with node-inspectorNEW
  • 10. msnodesql var sql = require('msnodesql'); sql.query(conn_str, 'SELECT * FROM Messages', function (err, results) { if (!err) ... } ); sql.queryRaw(conn_str, 'INSERT INTO Messages ...');
  • 11. Node with SQL Database Create an SQL database Get a connection string Open the firewall (if testing from premises) Node away!
  • 12. Shared DB with Mobile Services While we’re at it 
 Windows Azure Mobile Services makes implementing backends a breeze You can share a DB var table = MobileService.GetTable<Message>(); var messages = table.Where( m => m.User == "Sasha").ToList(); await table.InsertAsync(new Message(...));
  • 13. Node with Table Storage Windows Azure Table Storage is a lightweight, super-cheap, NoSQL data store Rows have dynamic properties Single primary key (index) var q = azure.TableQuery.select().from('messages'); tableService.queryEntities( q, function (err, results) ...); tableService.insertEntity('messages', newMsg, ...);
  • 14. Node on Azure Virtual Machines Install whatever you want Pick from Windows or Linux distros Microsoft open VMDepot offers dozens of images We’ll use MongoDB on Ubuntu And Mongoose for an ORM var db = mongoose.createConnection(...); var Message = db.model('Message', schema); Message.find(function (err, results) ...);
  • 15. Node Editor in The Cloud Visual Studio Online “Monaco”NEW is a cloud IDE for your Node/ASP.NET Azure web sites
  • 16. Questions Sasha Goldshtein CTO, SELA Group @goldshtn blog.sashag.net