Nifty web apps on an OpenResty



Similar documents
Google Web Toolkit (GWT) Architectural Impact on Enterprise Web Application

The Little Real-time Web Development Book

Progressive Enhancement With GQuery and GWT. Ray Cromwell

EWD: Simplifying Web Application Architecture

AJAX and jmaki for Web 2.0 Development using Java. Inyoung Cho Java Technology Evangelist Sun Microsystems, Inc.

Developing Offline Web Application

A Server and Browser-Transparent CSRF Defense for Web 2.0 Applications. Slides by Connor Schnaith

Implementing Mobile Thin client Architecture For Enterprise Application

Web Cloud Architecture

NoSQL web apps. w/ MongoDB, Node.js, AngularJS. Dr. Gerd Jungbluth, NoSQL UG Cologne,

Preface. Motivation for this Book

Web Security Testing Cookbook*

Category: Business Process and Integration Solution for Small Business and the Enterprise

Intro to Web Programming. using PHP, HTTP, CSS, and Javascript Layton Smith CSE 4000

Modern Web Development From Angle Brackets to Web Sockets

White Paper. The Power of Siebel escripting at Runtime. Bringing Siebel Developer Closer to Rapid Application Development

Mobile Web Applications using HTML5. L. Cotfas 14 Dec. 2011

WEB 2.0 AND SECURITY

An introduction to creating Web 2.0 applications in Rational Application Developer Version 8.0

Deepak Patil (Technical Director) iasys Technologies Pvt. Ltd.

Drupal CMS for marketing sites

Chatbots 3.3. Chatbots in Web Applications with RiveScript. Presented by Noah Petherbridge

Google Web Toolkit. Introduction to GWT Development. Ilkka Rinne & Sampo Savolainen / Spatineo Oy

Traitware Authentication Service Integration Document

Web Design Course. Home Page. Join in. Home. Objectives. Course Content. Assignments & Discussion. Grades. Help. Contact Me aab43@uakron.

Google Web Toolkit. Progetto di Applicazioni Software a.a. 2011/12. Massimo Mecella

Front-End Performance Testing and Optimization

What s really under the hood? How I learned to stop worrying and love Magento

Webapps Vulnerability Report

Web application Architecture

Certified PHP/MySQL Web Developer Course

Performance Testing for Ajax Applications

Choosing the Best Mobile Backend

<Insert Picture Here> Michael Hichwa VP Database Development Tools Stuttgart September 18, 2007 Hamburg September 20, 2007

Custom fields validation

Integration the Web 2.0 way. Florian Daniel April 28, 2009

Developing ASP.NET MVC 4 Web Applications

Credits: Some of the slides are based on material adapted from

Tutorial: Building a Dojo Application using IBM Rational Application Developer Loan Payment Calculator

Mobile development with Apache OFBiz. Ean Schuessler, Brainfood

Core Ideas CHAPTER 1 PART. CHAPTER 2 Pre-Ajax JavaScript Communications Techniques CHAPTER 3 XMLHttpRequest Object CHAPTER 4 Data Formats

Designing and Implementing an Online Bookstore Website

Advanced Web Development SCOPE OF WEB DEVELOPMENT INDUSTRY

Web Applications Testing

Paging, sorting, and searching using EF Code first and MVC 3. Introduction. Installing AdventureWorksLT database. Creating the MVC 3 web application

Web Development using PHP (WD_PHP) Duration 1.5 months

Web Design Technology

Creating, Sharing, and Selling Buzztouch Plugins

Developing ASP.NET MVC 4 Web Applications MOC 20486

How To Write A Web Server In Javascript

CSE598i - Web 2.0 Security OWASP Top 10: The Ten Most Critical Web Application Security Vulnerabilities

MASTERTAG DEVELOPER GUIDE

Integrating Web Application Security into the IT Curriculum

Finding and Preventing Cross- Site Request Forgery. Tom Gallagher Security Test Lead, Microsoft

Grunt, Gulp & fabs. Build-System and Development-Workflow for modern Web-Applications

OpenEdge and Mobile Applications

Web-Application Security

4 Understanding. Web Applications IN THIS CHAPTER. 4.1 Understand Web page development. 4.2 Understand Microsoft ASP.NET Web application development

This course provides students with the knowledge and skills to develop ASP.NET MVC 4 web applications.

Ads SPA with AngularJS Lab

SwiftScale: Technical Approach Document

DIPLOMA IN WEBDEVELOPMENT

Give a Push to Your Qt Application with Qt Cloud Services and WebSockets

4D as a Web Application Platform

Rich Web Applications in Server-side Java without Plug-ins or JavaScript

Monitor Your Home With the Raspberry Pi B+

Shopify Application Development

Create interactive web graphics out of your SAS or R datasets

New Features of SharePoint 2013

How To Write An Ria Application

Whitepaper. Rich Internet Applications. Frameworks Evaluation. Document reference: TSL-SES-WP0001 Januar

Secure Web Application Coding Team Introductory Meeting December 1, :00 2:00PM Bits & Pieces Room, Sansom West Room 306 Agenda

Developing ASP.NET MVC 4 Web Applications Course 20486A; 5 Days, Instructor-led

Citrix StoreFront. Customizing the Receiver for Web User Interface Citrix. All rights reserved.

Enabling AJAX in ASP.NET with No Code

Dynamic Web Programming BUILDING WEB APPLICATIONS USING ASP.NET, AJAX AND JAVASCRIPT

Grails 1.1. Web Application. Development. Reclaiming Productivity for Faster. Java Web Development. Jon Dickinson PUBLISHING J MUMBAI BIRMINGHAM

Table of contents. HTML5 Data Bindings SEO DMXzone

Storage Made Easy Enterprise File Share and Sync (EFSS) Cloud Control Gateway Architecture

SEO Optimization A Developer s Role

DOCUMENT REFERENCE: SQ EN. SAMKNOWS TEST METHODOLOGY Web-based Broadband Performance White Paper. July 2015

Developing a Web Server Platform with SAPI Support for AJAX RPC using JSON

.NET Best Practices Part 1 Master Pages Setup. Version 2.0

Web Enabling Solution for Windows Desktop Applications. White Paper

Introduction to the. Barracuda Embedded Web-Server

Maps & Directions App

Curl Building RIA Beyond AJAX

Creating Stronger, Safer, Web Facing Code. JPL IT Security Mary Rivera June 17, 2011

Apache Jakarta Tomcat

Spotfire and Tableau Positioning. Summary

Transcription:

Nifty web apps on an OpenResty

Nifty web apps on an OpenResty agentzh@gmail.com 章 亦 春 2008.4

The history of the web...

The history of the web... Web 1.0

Benefits Server code is easy to write. Browsers are easty to build as well. Web 1.0 Spiders are happy. Drawbacks Pages refresh everytime the user takes an action. Advanced spiders try very hard to extract data from HTML source. Blog owner's server is fat and hard to scale

The history of the web... Web 1.0 Web 2.0

Benefits Data can be applied to view templates on client side. Pages can be highly responsive via updaing just page regions. Drawbacks Server of the site owner is very fat, which is hard to deploy and hard to maintain.

The history of the web... Web 1.0 Web 2.0 Post-mordern Web 2.0

Benefits No database required on the site owner's server Database has the full posibility to scale Drawbacks Two HTTP round-trips are required Site owner's server is still fat.

The history of the web... Web 1.0 Web 2.0 Post-mordern Web 2.0 Web X

Benefits Clients access third-party service sites directly. Service is general, composible, and even recursive. All the Web 2.0 goodies. Site owner's server is extremely thin. Deployment of web sites is trivial. Drawbacks (which may be benefits at the same time) Web 1.0 spiders cannot find anything interesting at all in the HTML. Web sites are too easy to steal and re-distributed by others

We have already produced such web sites belonging to the Web X era! They're powered by the OpenResty platform. They're written completely in JavaScript. They consist of static files only.

My blog site http://blog.agentzh.org

Yisou BBS http://www.yisou.com/opi/post.html

OpenResty Admin site http://resty.eeeeworks.org/admin/

My blog site = index.html + openresty.js + blog.js + jemplates.js + jquery.js + JSON.js + CSS/image

Hey, my readers can write a new blog site for my articles atop the OpenResty API exposed by my "agentzh" account without my permission!

<!-- index.html --> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script src="json.js"></script> <script src="openresty.js"></script> <script src="blog.js"></script> <title>my blog</title> </head> <body onload="init()"> <div id="main"></div> </body> </html>

// blog.js var openresty = null; function init () { openresty = new OpenResty.Client( { server: 'http://api.eeeeworks.org', user: 'agentzh.public' } ); openresty.callback = renderposts; openresty.get( '/=/model/post/~/~', { offset: 0, count: 10, order_by: 'id:desc' } ); }

// blog.js (continued) function renderposts (res) { if (openresty.issuccess(res)) { var html = ''; for (var i = 0; i < res.length; i++) { var post = res[i]; html += "<h1>" + post.title + "</h1>" + post.content + "<p>posted by " + post.author + "</p>"; } document.getelementbyid("main").innerhtml = html; } else { alert("failed to fetch posts: " + res.error); } }

Hey, it runs now!

Hey, it runs now! $ firefox ~/Desktop/sample/index.html

Concatenating HTML strings is boring and no fun :(

Concatenating HTML strings is boring and no fun :( Some Jemplate love

<!-- post-list.tt --> [% FOREACH post = posts %] <h1>[% post.title %]</h1> [% post.content %] <p>posted by [% post.author %]</p> [% END %]

$ jemplate --runtime > jemplates.js $ jemplate --compile post-list.tt >> jemplates.js

<!-- index.html --> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script src="json.js"></script> <script src="openresty.js"></script> <script src="blog.js"></script> <script src="jemplates.js"></script> <title>my blog</title> </head> <body onload="init()"> <div id="main"></div> </body> </html>

// blog.js (continued) function renderposts (res) { if (openresty.issuccess(res)) { var html = Jemplate.process( 'post-list.tt', { posts: res } ); document.getelementbyid("main").innerhtml = html; } else { alert("failed to fetch posts: " + res.error); } }

Hey, it runs again!

Hey, it runs again! $ firefox ~/Desktop/sample/index.html

So what is OpenResty then?

OpenResty is a general-purpose RESTful web service platform REST wrapper for relational databases Virtual web runtime for RIA "meta web site" supporting other sites via web services handy web database which can be accessed from anywhere

OpenResty is NOT a server-side web application framework. relacement for highly scalable semi-structured data storage solutions like Amazon SimpleDB or CouchDB.

OpenResty offers (scalable) relational data storage truely RESTy interface JSON/YAML data transfer format SQL-based reusable views a REST-oriented role system for ACL view-based RSS feeds user-defined actions in RestyScript native captchas cross-site AJAX support

The OpenResty FastCGI server is currently written in Perl 5.

The PgFarm backend of OpenResty is designed to be scalable.

"How can I get started?" Write to agentzh@gmail.com to request an OpenResty account OpenResty is on CPAN already! http://search.cpan.org/dist/openresty

"Where can I learn more about OpenResty?" See the OpenResty::Spec::Overview document http://search.cpan.org/perldoc?openresty::spec::overview

"How can I get involved?" Write to agentzh@gmail.com to ask a commit bit! http://svn.openfoundry.org/openapi/trunk

Any questions?