SPA BARTOSZ LENAR. THE PLAN  what is spa?  how it works?  how to start building one?

Slides:



Advertisements
Similar presentations
SharePoint and Knockout for the REST of Us
Advertisements

Single Page Apps with Breeze and Ruby.
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
John Culviner johnculviner.com DEMO CODE:
Developing HTML5 Application using MVVM pattern Pekka Ylenius.
Building HTML and JavaScript Apps with KnockoutJS and MVVM DEV361.
IS 360 Course Introduction. Slide 2 What you will Learn (1) The role of Web servers and clients How to create HTML, XHTML, and HTML 5 pages suitable for.
Performed by:Gidi Getter Svetlana Klinovsky Supervised by:Viktor Kulikov 08/03/2009.
1 JavaScript & AJAX CS , Spring JavaScript.
Where Do I Start REFERENCE: LEARNING WEB DESIGN (4 TH EDITION) BY ROBBINS 2012 – CHAPTER 1 (PP. 3 – 14)
Intelligent Tutoring System Mobile Communication Team Drew Boatwright Nakul Dureja Richard Liou.
Agenda What is AJAX? What is jQuery? Demonstration/Tutorial Resources Q&A.
1 Web Servers (IIS and Apache) Outline 9.1 Introduction 9.2 HTTP Request Types 9.3 System Architecture 9.4 Client-Side Scripting versus Server-Side Scripting.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
Rich Internet Applications 7. Single-page application architecture.
NextGen Technology upgrade – Synerizip - Sandeep Kamble.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
JavaScript Teppo Räisänen LIIKE/OAMK HTML, CSS, JavaScript HTML defines the structure CSS defines the layout JavaScript is used for scripting It.
Chapter 3 Using Validation Controls. What is a Validation Control? A control that validates the value in another control Renders as an HTML tag with an.
Component-Based Software Engineering Internet Applications Paul Krause.
HTML Forms and Scripts. Session overview What are forms? Static vs dynamic Client-side scripts –JavaScript.
Lecture 12 – AJAX SFDV3011 – Advanced Web Development Reference: 1.
Knock the jQuery out! Bartosz
ASP.NET + Ajax Jesper Tørresø ITNET2 F08. Ajax Ajax (Asynchronous JavaScript and XML) A group of interrelated web development techniques used for creating.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
November 13, 2008 Ohio Information Security Forum Attack Surface of Web Applications James Walden Northern Kentucky University
JavaScript is a client-side scripting language. Programs run in the web browser on the client's computer. (PHP, in contrast, is a server-side scripting.
1 Goals and Objectives Goals Goals Understand how JavaScript makes it possible to interact with web pages, minimizes client/server traffic, enables verification.
Web Mashups -Nirav Shah.
The Web Architecture and ASP.NET. Slide 2 Review of the Web (1) It began with HTTP and HTML, which delivers static Web pages to browsers which would render.
10/13/2015 ©2006 Scott Miller, University of Victoria 1 Content Serving Static vs. Dynamic Content Web Servers Server Flow Control Rev. 2.0.
1 Tucker Lein, Justin Price, Cody Robinson, and Jennifer Gay Team07.
SDC 2013 SPA Made Breezy Tiberiu Covaci Ward Bell, v.p. of technology, IdeaBlade.
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 14 Database Connectivity and Web Technologies.
Canopy walk through Single-Page Apps (SPAs) Benjamin Howarth Freelancer, Code Gecko Umbraco UK Festival, Fri 30 th Oct 2015 CODE GECKO.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
Securing Angular Apps Brian Noyes
Getting Started with Aurelia
The basics of knowing the difference CLIENT VS. SERVER.
AJAX and REST. Slide 2 What is AJAX? It’s an acronym for Asynchronous JavaScript and XML Although requests need not be asynchronous It’s not really a.
Document Object Model Nasrullah. DOM When a page is loaded,browser creates a Document Object Model of the Page.
Introduction to AJAX Sue Brandreth. What is Ajax?
Model View ViewModel Architecture. MVVM Architecture components.
PHP and AJAX. Servers and Clients For many years we tried to move as much as possible to the server. Weak clients, poor bandwidth, browser compatibility..
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
Introduction to ASP.NET development. Background ASP released in 1996 ASP supported for a minimum 10 years from Windows 8 release ASP.Net 1.0 released.
Modern Development Technologies in SharePoint SHAREPOINT SATURDAY OMAHA APRIL, 2016.
The New Face of ASP.NET ASP.NET MVC, Razor, and jQuery Ido Flatow | Senior Architect | Sela | This session is.
Developing Windows 8 Style Application With HTML and JavaScript Lino Tadros | Falafel Software.
Google Analytics Graham Triggs Head of Repository Systems, Symplectic.
Martin Kruliš by Martin Kruliš (v1.0)1.
Basics Components of Web Design & Development Basics, Components, Design and Development.
JavaScript Invented 1995 Steve, Tony & Sharon. A Scripting Language (A scripting language is a lightweight programming language that supports the writing.
AngularJS. What is AngularJS  Javascript Framework  MVC  for Rich Web Application Development  by Google.
Vineel Vutukuri. What is SPA? Why SPA? Pros & Cons When to use SPA?
MVC 4.0, Knockout.js, Bootstrap and EF6.0 FAST, FLEXIBLE AND RESPONSIVE QUICK TO MARKET WEBSITES.
Developers Introduction to the Power BI Platform.
An Introduction to Web Application Security
Unleash the Power of jQuery
Google Web Toolkit Tutorial
Kendo UI Builder Bob Brennan
AJAX and REST.
CMPE 280 Web UI Design and Development October 26 Class Meeting
KnockoutJS -Pradeep Shet 31st August 2014.
AJAX.
MEAN stack L. Grewe.
Rich single page applications with SharePoint
JavaScript & jQuery AJAX.
Running C# in the browser
Presentation transcript:

SPA BARTOSZ LENAR

THE PLAN  what is spa?  how it works?  how to start building one?

RELOADING

TRADITIONAL BROWSING GET example.org/users HTML GET example.org/users/bartek HTML

SPA AGAINST RELOADING GET example.org/#/users HTML GET example.org/#/users/bartek JSON

SPA PHILOSOPHY  views = htmls  logic = javascripts  media = images & csses  gui api = browser

PACKAGE LOADING first call app package

PACKAGE WORKING GET example.org/users/bartek 200 OK … { UserName: "Bartek", … } POST example.org/users/bartek 403 FORBIDDEN

WHY  web app goes restfull  full control over the app  data amount reduction  easy conversion to offline  and mobile!  much more stuff to take care about  first-loading time  heavy client-side logic

PACKAGE

SPA PACKAGE  root app model

DOES IT SOUND TOO 2005?

NAVIGATION

H#SH ROUTING About

HISTORY API  pushState  window.onpopstate

ARCHITECTURE

MVVM backend system REST communication javascript object MVVM-framework binding & notifications HTML

CLIENT SIDE MVVM (KNOCKOUT STYLE) user: { id: ko.observable(666), name: ko.observable("bartek") }

SPA PACKAGE PARTS  views and viewmodels repository  dependency injection MENU LOGIN USER

MODEL FLOW

BACKEND [dbo].[users] ( [id] [uniqueidentifier] NOT NULL, [name] [nvarchar](256) NOT NULL, [countryId] [int] NULL ) public class User { public Guid Id { get; set; } public string Name { get; set; } public int CountryId { get; set; } public Country Country { get; set; } }

BACKEND SCHEMA User.cs [dbo].[users] DATA REPOSITORIES SERVICES

FRONTEND public class UserModel { public Guid? Id { get; set; } public string Name { get; set; } public int? CountryId { get; set; } } var UserViewModel = (function () { function UserViewModel() { this.Id = ko.observable(); this.Name = ko.observable(); this.CountryId = ko.observable(); } return UserViewModel; })();

FRONTEND SCHEMA User.html UserViewModel.js UserModel.cs User.cs [dbo].[users] DATA REPOSITORIES SERVICES CONTROLER VIEWMODEL (client) VIEW

how to do a selectable item?

PAGE MODELS  everything we need to handle a page logic and view  server-side contains:  models  dictionaries & used values  all additional data & user context  client-side contains:  events emition  all actions and view logic

UserPageModel.csUserPageViewModel.js PAGE MODELS SCHEMA User.html UserViewModel.js UserModel.cs User.cs [dbo].[users]

MODEL FLOW CHAPTER 3 : PAGE MODELS public class UserPageModel { public UserModel User { get; set; } public Country[] Countries { get; set; } public bool WithEditRights { get; set; } } var UserPageViewModel = (function () { function UserPageViewModel() { this.User = new UserViewModel(); this.Countries = ko.observableArray(); this.SaveChanges = function() {... } } return UserPageViewModel; })();

SELECTABLE ITEM <select data-bind="options: $parent.Countries, optionsText: 'Name', optionsValue: 'Id', value: CountryId" >

MAPPING OBJECTS  making pure json ready to bind (observables)  validation  creates additional methods & properties  reversing the whole process! UserViewModel.js MAPPING: observables & additional stuff SERIALIZING: json UserModel.cs

FLOW GET api/users/666example.org/users/666 { id: 666, name: "bartek" } User.htmlUser.js insert + map data render html + bind

PRELOADING

 bundle javascripts into modules-packs  check which are available to the logged in user  load scripts & structures  HTML5 async  require.js  separate areas  login!

DICTIONARIES Countries = [ { Id: '0', Name: 'Poland'}, { Id: '1', Name: 'England'}, { Id: '2', Name: 'USA'}, { Id: '3', Name: 'New Zealand'}, ]

SELECTABLE ITEM <select data-bind="options: Values.Countries, optionsText: 'Name', optionsValue: 'Id', value: CountryId" >

LOCALIZATION Phrases = {} Phrases['Poland'] = 'Polska'; Phrases['England'] = 'Anglia'; Phrases['USA'] = 'USA'; Phrases['New Zealand'] = 'Nowa Zelandia';

LOCALIZATION HELPER

API WRAPPER  spinner  common settings for all calls  cache  content-type  common reactions for all responses  400, 401, 403, etc.  validation  handle CSRF validation api.Put('users', userModel).success(function() { alert(Phrases['Success']); }).fail(function() { alert(Phrases['Error']); });

OTHER STUFF  interaction between sites  ioc container  unit tests  no browser required  model validation  online to offline  disable lazy loading  inject different api wrapper?

BARTOSZ LENAR  flaticon.com  freepik.com SPA