26
Angular JS + NancyFx + MongoDB = Ultimate Trio For Building SPA apps Bojan Veljanovski, Software Engineer & Lead Technology Researcher, HASELT @bojanv91

AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

Embed Size (px)

DESCRIPTION

The complete demo project from my CodeCamp's 2013 session "AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA" can be found on github: http://bit.ly/JqrJWm

Citation preview

Page 1: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

Angular JS + NancyFx + MongoDB = Ultimate Trio For Building SPA apps

Bojan Veljanovski,Software Engineer &

Lead Technology Researcher,

HASELT

@bojanv91

Page 2: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski
Page 3: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

Bojan VeljanovskiSoftware Engineer and

Lead Technology Researcher, HASELTMicrosoft Certified ProfessionalTechnical Speaker

Ex - Microsoft Student Partner Co-Founding member, Leader & Speaker of FINKI Tech

Club

@bojanv91

Page 4: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

“It's not longer good enough to build web apps around full page

loads and then progressively enhance them to behave more

dynamically .”

- Throne of JS Conference, 2012

Page 5: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

Traditional Web App

Web Page

Web PagePage HTML

Server Browser

Navigate

Page HTML

Page 6: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

Next-Gen WebThe web is moving to the client

Page 7: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

What’s in the session?What is Single Page Application– and why it matters

Basic concepts for successful SPA– and tools for building it

How to build complete end-to-end SPA in few steps– e.g. Let’s c0de!

Page 8: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

What is SPA?

Rich and responsive web applicationAll HTML/CSS/JS are loaded onto one pageNew content is pulled via AJAXUI interactions are handled in the browserExamples: – GitHub, Gmail, Azure Management Portal

Page 9: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

Characteristics of good SPAs

Based on HTML, CSS and JavaScriptDoes NOT break the browserFast and responsive– Should feel like native application

Reduces server overhead

Page 10: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

How SPA works

Server Client

Web UIHTML/CSS/JS

REST Services

JSON / XML

Page Load (index.html)

Page 11: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

Common SPA features

MVC - basedData-binding (2-way)Declarative programmingRouting Encourages modularization

Page 12: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

Frameworks & Libraries

Page 13: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski
Page 14: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

Angular.js

Very light frameworkLarge communityGreat documentation Encourages good design patternsIdeal for CRUD apps

Page 15: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

Angular.js 101

Page 16: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

Angular.js 102

Page 17: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

Angular.js – Full Stack

Page 18: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski
Page 19: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

Nancy (Back-end)

Lightweight framework for building HTTP services

Open Source C#/.NET/MonoInspired by Sinatra from Ruby worldYou can write Hello World Nancy app into a

single tweet (DEMO!)

Page 20: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

NoSQLOpen-sourceDocument-oriented storage– JSON-style documents

Scalable LINQ support with C# driver

MongoDB (Storage)

Page 21: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

LET’S C0DE

Source Code of the Demo on GitHub: http://bit.ly/JqrJWm

Page 22: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

Outcomes from the SPA approach

Front-end becomes almost NativeBack-end becomes just Clean and Thin APIStorage becomes natural for the Web (JSON)

Page 23: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

Use cases when to go to SPA…

Highly interactive web appsData intensive web appsMobile web apps– With offline support (cache manifest, local

storage)Apps meant to be used for long continuous

period

Page 24: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

…but careful, SPA roads are bumpy

Code duplication on client and server can occur

Secure your APIs SPA stacks depend on many 3-rd party

libraries, beware of compatibility issuesStep learning curveStrong JavaScript skills are required

Page 25: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski

Questions?Complete electronic evaluation

forms on the computers in the hall and enter to win!– Telerik Ultimate Collection– CodeSmith Tools Generator Pro

Personal– JetBrains ReSharper– Seavus EDC training vouchers– Pluralsight subscriptions– and many more…

Page 26: AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Veljanovski