NodeJS and JavaScripteverywhere

Similar documents
NODE.JS SERVER SIDE JAVASCRIPT. Introduc)on Node.js

Module 6 Node.js and Socket.IO

END-TO-END JAVASCRIPT WEB APPS

We are assuming you have node installed!

What is Node.js? Tim Davis Director, The Turtle Partnership Ltd

AWS Lambda + nodejs Hands-On Training

Jquery.ajax Call Returns Status Code Of 200 But Fires Jquery Error

A practical introduction

Thursday, July 19, 12. [Introduction to] Writing nonblocking code... in Node.js and Perl

OWASP Switzerland. October 22th 2013

[Introduction to] Writing non-blocking code... in Node.js and Perl

Node.js. Node.js Overview. CS144: Web Applications

Backend Development. SWE 432, Fall Web Application Development

NODE.JS MOCK TEST NODE.JS MOCK TEST I

Who am I? Weibo:

Intel Do-It-Yourself Challenge Lab 5: Controlling Galileo from a webpage Nicolas Vailliet

Copyright by Object Computing, Inc. (OCI). All rights reserved. Strata

node.js A quick tour (v4)

delegator Documentation

JavaScript on the Command Line & PRATIK PATEL CTO TripLingo Labs

Adventures with BaseX and web applications. Andy Feb 2013

Smashing Node.JS: JavaScript Everywhere

Microservices with Node.js

welcome to BOILERCAMP HOW TO WEB DEV

A T O O L K I T T O B U I L D D I S T R I B U T E D R E A C T I V E S Y S T E M S

Tuesday, January 13, Backend III: Node.js with Databases

MEAN February. techdt.la

Rethinking monitoring with Prometheus

Node.js. Mendel Rosenblum. CS142 Lecture Notes - Node.js

Evolution of the "Web

Backend Development. SWE 432, Fall 2017 Design and Implementation of Software for the Web

JS Event Loop, Promises, Async Await etc. Slava Kim

Real-time node.js: Instrumentation, Visualization & Debugging. Bryan Cantrill SVP,

Streams, Pipes and Mega Pipes

Tools. SWE 432, Fall Design and Implementation of Software for the Web

Networking & The Web. HCID 520 User Interface Software & Technology

Sessions. Mendel Rosenblum. CS142 Lecture Notes - Sessions

Lecture 18. WebSocket

Web Application Development

WorldSpace Attest Quick Start Guide

iframe programming with jquery jquery Summit 2011

Index. Ray Nicholus 2016 R. Nicholus, Beyond jquery, DOI /

MOdern Java(Script) Server Stack

Persistence & State. SWE 432, Fall 2016 Design and Implementation of Software for the Web

A Node.js tutorial by Manuel Kiessling

CSC309 - Winter Lab 9 - Understanding JS Event Loops, Scopes and JSONP

Getting Started With NodeJS Feature Flags

Firefox Crash Reporting.

Developer Internship Opportunity at I-CC

this presentation code is on

KonaKart Shopping Widgets. 3rd January DS Data Systems (UK) Ltd., 9 Little Meadow Loughton, Milton Keynes Bucks MK5 8EH UK

CS 498RK FALL RESTFUL APIs

Full Stack boot camp

Networking & The Web. HCID 520 User Interface Software & Technology

Quick Desktop Application Development Using Electron

Asynchronous JS. SWE 432, Fall Web Application Development

5th April Installation Manual. Department of Computing and Networking Software Development Degree

INF5750. Introduction to JavaScript and Node.js

How to Implement a Web-based Terminal with Docker

Lecture 10(-ish) Web [Application] Frameworks

RKN 2015 Application Layer Short Summary

Make your application real-time with PubSubHubbub. Brett Slatkin May 19th, 2010

MySQL. The Right Database for GIS Sometimes

Mastering Node. Mastering Node 1

JavaScript. The Bad Parts. Patrick Behr

ethnio tm Technical Overview VERSION NO. 6 CREATED AUG 22, 2018 ETHNIO, INC W SUNSET BLVD LOS ANGELES, CA TEL (888)

Modern Web Application Development. Sam Hogarth

DECOUPLING PATTERNS, SERVICES AND CREATING AN ENTERPRISE LEVEL EDITORIAL EXPERIENCE

CSCI-1680 Network Programming II. Rodrigo Fonseca

Web AppBuilder for ArcGIS: A Deep Dive in Enterprise Deployments. Nick Brueggemann and Mark Torrey

IERG 4080 Building Scalable Internet-based Services

RED HAT'S CONTAINER STRATEGY. Lars Herrmann General Manager, RHEL, RHEV and Containers June 24, 2015

Node.js By Example. Learn to use Node.js by creating a fully functional social network. Krasimir Tsonev BIRMINGHAM - MUMBAI

COPYRIGHTED MATERIAL. Part I: Getting Started. Chapter 1: Introducing Flex 2.0. Chapter 2: Introducing Flex Builder 2.0. Chapter 3: Flex 2.

Comet and WebSocket Web Applications How to Scale Server-Side Event-Driven Scenarios

Front End Programming

Reactive Java: Promises and Streams with Reakt. Geoff Chandler and Rick Hightower

Arjen de Blok. Senior Technical Consultant bij ICT Groep ( sinds 1995 Programmeren sinds 1990 Technologiën. Links

Node.js Paradigms and Benchmarks

Mixed Signals Using Fusion s Signals API

Present and Future of the RhoMobile platform. Migrating legacy applications, Node.js on mobile devices right now and more

Persistence. SWE 432, Fall 2017 Design and Implementation of Software for the Web

Viewer 2.0. Shared Media one of the exciting improvements! 2010 Linden Lab 2

Javascript. Some tools for building web- based groupware. Javascript. Javascript. Master Informa-que - Université Paris- Sud 1/15/14

Masters in Web Development

Java vs JavaScript. For Enterprise Web Applications. Chris Bailey IBM Runtime Technologies IBM Corporation

Future Web App Technologies

Tooling for Ajax-Based Development. Craig R. McClanahan Senior Staff Engineer Sun Microsystems, Inc.

Heroku. Rimantas Kybartas

About 1. Chapter 1: Getting started with odata 2. Remarks 2. Examples 2. Installation or Setup 2. Odata- The Best way to Rest 2

Intro To Javascript. Intro to Web Development

Lecture 2 Callbacks, Events, and Asynchronous Programming

Unifer Documentation. Release V1.0. Matthew S

Fixing Twitter.... and Finding your own Fail Whale. John Adams Twitter Operations

Catbook Workshop: Intro to NodeJS. Monde Duinkharjav

Enhancing cloud applications by using external authentication services. 2015, 2016 IBM Corporation

CS193X: Web Programming Fundamentals

Angular 2 and Hexo. Static Meets Dynamic For the Best of Both Worlds! Copyright 2016 Code Career Academy

Project Avatar: Server Side JavaScript on the JVM GeeCon - May David Software Evangelist - Oracle

Introduction to RPC, Apache Thrift Workshop. Tomasz Powchowicz

Transcription:

NodeJS and JavaScripteverywhere Matthew Eernisse YOW Conference: December 2011

Who am I? Matthew Eernisse Work at Yammer @mde on Twitter

What is JavaScript- everywhere?

A list of stuff Ruby JavaScript Scala Java C# Rails NodeJS PostgreSQL Memcache Riak Redis BDB Vertica R

JavaScript at Yammer Browsers YamJS, a.k.a., YamJuice Adobe AIR Desktop V8 in Rails via TheRubyRacer NodeJS

Server JS

SSJS Netscape Enterprise Server (OG SSJS) Microsoft IIS Helma (now RingoJS) Whitebeam Zimki Jaxer Perservere Nitro Google App Engine CouchDB NodeJS

Why NodeJS? Death of Netscape Open source Yegge s NBL, 2007-02-10 Competition V8

NodeJS: Evented I/O for V8 JavaScript http://nodejs.org/

Hello, NodeJS var http = require('http'); http.createserver(function (req, res) { res.writehead(200, {'Content-Type': 'text/plain'}); res.end('hello World\n'); }).listen(1337, "127.0.0.1"); console.log('server running at ' + ' http://127.0.0.1:1337/');

What can you do with Node?

EventEmitter Readable/WritableStream Callbacks

Jake build tool https://github.com/mde/jake Tasks, prerequisites File tasks, directory tasks Namespaces PackageTasks Just executable JavaScript Async task execution (shell commands)

namespace('foo', function () { desc('this a sychronous task'); task('bar', function () { console.log('howdy'); }); }); desc('this an asychronous task'); task('baz', function () { require('child_process').exec('ls -l', function (err, stdout, stderr) { console.log(stdout); complete(); }); }, {async: true});

Geddy Web framework: https://github.com/mde/geddy

NodeJS at Yammer Upload service for files and images Realtime, collaborative documentediting feature Another, early-alpha service for mobile Web

Remote upload service Minimal v1 in prod, Nov. 2010 Onboard thumbnailing, remote services for video and document post-processing Redis, CORS XHR-push or JSONP for upload-progress reporting

Realtime, collaborative documents feature In beta Oct. 21, 2011 EtherPad Lite (https://github.com/pita/ etherpad-lite): NodeJS, Socket.io, PostgreSQL

Coding JS for Node

Flexibility

Async horror Even shelling out is async? Inside-out execution Evented and callback-based control-flow

Sync fetch-and-update var fetchandupdate = function (params) { var items = db.fetch(somequery); for (var i = 0, ii = items.length; i < ii; i++) { item.update(params); } return true; };

Async fetch-and-update var fetchandupdate = function (params, callback) { db.fetch(somequery, function (items) { var count = 0; for (var i = 0, ii = items.length; i < ii; i++) { item.update(params, function () { count++; if (count == ii) { callback(true); } }); } }); };

Is this familiar? jquery.ajax({ url: '/foo/bar.json', success: function () { alert('yay!'); } }); jquery('#foo').bind('click', function (e) { // Do some stuff });

Async patterns and libs Async queue Promise/deferred/future/eventual

Promise var p = new yammer.util.promise(); p.when('foo', 'bar', 'baz').then( function () { console.log('done!'); }); p.satisfy('foo'); p.satisfy('bar'); p.satisfy('baz'); p.then(function () { console.log('still done!'); });

Don t overdo it.

NodeJS in production

App dependencies NPM is awesome Third-party modules still may change rapidly Maintain forks, push back patches where appropriate

Assume you re fucked Callbacks in global scope have no stack

uncaughtexception handler Preemptible timeout-errors Timeout registry

Timeout registry Entries in an object with keys Per-item timeout Configurable polling-interval Define a timeout-handler

Timeout registry var TimeoutReg = require('timeout_registry').timeoutreg, handler = function (req, resp) { var registry = new TimeoutReg(function (key) { resp.writehead(500); resp.end('oops, something bad happened.'); }); registry('foo', 10000); performfoo(req, function (result) { if (result.ok) { registry.clear('foo'); // Do some other stuff resp.writehead(200); resp.end('hooray!'); } }); }; process.on('uncaughtexception', function (err) { // Do some kind of logging });

Visibility, metrics Measure everything Log everything https://github.com/mikejihbe/metrics

Ops Communicative, consultative dev Ask what is expected Be transparent Play nicely with others

Try it; you ll like it.

Matthew Eernisse http://twitter.com/mde Yammer Developer Center http://developer.yammer.com/