Building APIs with NodeJS on Microsoft Azure Websites - Redmond
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Building APIs with NodeJS on Microsoft Azure Websites - Redmond

on

  • 450 views

Visual Studio Live Redmond 2014 - code https://github.com/rickggaribay/IoT

Visual Studio Live Redmond 2014 - code https://github.com/rickggaribay/IoT

Statistics

Views

Total Views
450
Views on SlideShare
113
Embed Views
337

Actions

Likes
1
Downloads
2
Comments
0

4 Embeds 337

http://rickgaribay.net 304
http://www.rickgaribay.net 31
http://www.slideee.com 1
http://feedly.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Building APIs with NodeJS on Microsoft Azure Websites - Redmond Presentation Transcript

  • 1. Building APIs with NodeJS on Microsoft Azure Websites Rick G. Garibay VP, Distinguished Engineer Level: Intermediate
  • 2. About Me • VP, Distinguished Engineer leading the Development Platform Group at Neudesic • Working on IoT, Intelligent Transportation and Hospitality & Gaming • Microsoft MVP, Microsoft Azure • Co-Author, “Windows Server AppFabric Cookbook” by Packt Pub. • Chairman, Co-Founder Phoenix Connected Systems User Group (PCSUG.org) • twitter: @rickggaribay • blog: http://rickgaribay.net • email: rick.garibay@neudesic.com | b-rigari@microsoft.com
  • 3. The problem with long URLs…
  • 4. http://mysadsharepointsite/not/rest/ful/Foo.aspx? RootFolder=%2Fpractice%2FConnected%5FSystem s%2FDocuments%2F5%2E%20Training%20Resourc es&FolderCTID=0x0120006C1E110A70E85644A26E 2C21A71B0D82&View={8F82FE4D-9398-4892- B6E6-C2D9C2AB2BE8}
  • 5. A terrible user experience at best.
  • 6. But worse, a missed opportunity…
  • 7. Every URL you send a customer, partner, prospect is an opportunity to make a branding impression.
  • 8. http://mysadsharepointsite/not/rest/ful/Foo.aspx? RootFolder=%2Fpractice%2FConnected%5FSystem s%2FDocuments%2F5%2E%20Training%20Resourc es&FolderCTID=0x0120006C1E110A70E85644A26E 2C21A71B0D82&View={8F82FE4D-9398-4892- B6E6-C2D9C2AB2BE8}
  • 9. http://neurl.it/pewUGm
  • 10. Marketing Campaigns Advertisements Promotions Internal Communication A/B Testing
  • 11. neurl.it v0.1 • Shorten/Create – When I submit a long, ugly URL to the create API, I should get back a neurl. • Redirect – When I submit a neurl to the submit API, my request should be automatically redirected. • Hits – When I submit a neurl to the hits API, I should get back the number of hits/redirects for that neurl.
  • 12. http://mysadsharepointsite/not/rest/ful/Foo.aspx? RootFolder=%2Fpractice%2FConnected%5FSystem s%2FDocuments%2F5%2E%20Training%20Resourc es&FolderCTID=0x0120006C1E110A70E85644A26E 2C21A71B0D82&View={8F82FE4D-9398-4892- B6E6-C2D9C2AB2BE8}
  • 13. POST http://neurl.it/create HTTP/1.1 User-Agent: Fiddler Host: neurl.it Content-Type: application/json; charset=utf-8 Content-Length: 36 {"Url" : "http://rickgaribay.net"} HTTP/1.1 200 OK X-Powered-By: Express Content-Type: application/json; charset=utf-8 Content-Length: 57 Date: Fri, 08 Mar 2013 05:00:21 GMT Connection: keep-alive { "http://neurl.it/pewUGm" }
  • 14. What is NodeJS? • Server-side scripting framework based on the Google V8 engine accessible via JavaScript. • Asynchronous by nature, making it very performant. • Growing community and industry support, including libraries (modules).
  • 15. Hello Node // Say Hello via Console console.log("Hello World");
  • 16. Hello Node // Load the http module to create an http server. var http = require('http'); // Configure our HTTP server to respond with Hello World to all requests. var server = http.createServer(function (request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.end("Hello Worldn"); }); // Listen on port 8000 server.listen(8000); // Put a friendly message on the terminal console.log("Server running at http://127.0.0.1:8000/");
  • 17. NodeJS Fundamentals • Node Package Manager (NPM) – Package manager for downloading and referencing thousands of NodeJS modules. • Package.json – Captures information about modules (including your project/module) and dependencies. • Server.js – Typical entry point to a NodeJS application but any .js will do. • Running NodeJS apps is as simple as this: > node server.js
  • 18. Client Event Loop Callback Workers IO Response
  • 19. Why Node? • My goal is not to convince you to use NodeJS over ASP.NET, Web API, WCF or any other back-end framework.
  • 20. Why Node? • Rather, I want to show you a practical example of what you can do with NodeJS. • Alternate implementations, either in NodeJS or other platforms, frameworks and languages is left as an exercise to the reader.
  • 21. Implementing the Create API SHOW ME TEH CODEZ
  • 22. GET http://neurl.it/pewUGm HTTP/1.1 User-Agent: Fiddler Host: neurl.it Content-Type: application/json; charset=utf-8 Content-Length: 0 HTTP/1.1 302 Moved Temporarily X-Powered-By: Express Location: http://rickgaribay.net Vary: Accept Content-Type: text/plain Content-Length: 56 Date: Fri, 08 Mar 2013 05:16:45 GMT Connection: keep-alive Moved Temporarily. Redirecting to http://rickgaribay.net
  • 23. Implementing the Redirect API SHOW ME TEH CODEZ
  • 24. GET http://neurl.it/pewUGm/hits HTTP/1.1 User-Agent: Fiddler Host: neurl.it Content-Type: application/json; charset=utf-8 Content-Length: 0 HTTP/1.1 200 OK X-Powered-By: Express Content-Type: text/html; charset=utf-8 Content-Length: 2 Date: Fri, 08 Mar 2013 05:21:37 GMT Connection: keep-alive 42
  • 25. Implementing the Hits API SHOW ME TEH CODEZ
  • 26. Supported Publishing Methods
  • 27. Supported Web Frameworks
  • 28. Diagnostics & Monitoring
  • 29. 10 free sites. Multi-tenant. Daily quotas 100 free sites. Multi-tenant. Daily quotas Unlimited. Dedicated VMs. No quotas Unlimited. Dedicated VMs. + more
  • 30. shared 1
  • 31. shared 2
  • 32. Deploy Neurl.it to Azure with Git & Scale DEMO
  • 33. Windows Azure Web Sites
  • 34. Start Simple Get started with 10 free web sites Create new sites in seconds Easily manage and scale your sites Automatic load balancing and shared storage across instances Scale out or up to reserved instances for improved performance and scale
  • 35. Code Smart Use ASP.NET, ASP, PHP, or NodeJS SQL Azure or MySQL databases Start with open source apps and frameworks Develop with VS and WebMatrix Supports any Web development tool on any platform (Windows, OSX, Linux)
  • 36. Go Live Rapid deployment for quick iteration Integrated source control with Team Foundation Server (TFS) and Git Built-in monitoring of perf and usage data Quick access to request logs, failed requests diagnostics and diagnostics
  • 37. Resources • Building Hypermedia APIs with HTML5 and Node by Mike Amudsen • Express http://expressjs.com/ • Mocha http://visionmedia.github.com/mocha/ • Should https://github.com/lukebayes/node-should • SuperTest https://github.com/visionmedia/supertest • MongoDb http://www.mongodb.org/ • Mongoose https://github.com/LearnBoost/mongoose • Fiddler http://www.fiddler2.com/fiddler2/ • Microsoft Azure: http://Azure.com • Configuring Domain Names on Azure Websites http://bit.ly/1pvOclY Azure CLI http://azure.microsoft.com/en-us/ documentation/articles/xplat-cli/
  • 38. About Me • VP, Distinguished Engineer leading the Development Platform Group at Neudesic • Working on IoT, Intelligent Transportation and Hospitality & Gaming • Microsoft MVP, Microsoft Azure • Co-Author, “Windows Server AppFabric Cookbook” by Packt Pub. • Chairman, Co-Founder Phoenix Connected Systems User Group (PCSUG.org) • twitter: @rickggaribay • blog: http://rickgaribay.net • email: rick.garibay@neudesic.com | b-rigari@microsoft.com