SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Downloaden Sie, um offline zu lesen
by
Michael Hackstein
@mchacki
Build a SPA in 30min
Michael Hackstein
@mchacki
• Member of ArangoDB
Core Team
• web front-end
• graph features
• Organizer of cologne.js
• Master’s Degree

(spec. Databases and

Information Systems)
Single Page
Web Applications
The Idea
• What if we could talk to
the database directly?
• It would only need an API
• What if we could define
this API in JavaScript?
Single Page
Web Applications
This doesn‘t mean its a Rails/… Killer
Client Server DB
Client Server
(optional)
DB
with Foxx
What is ?
• Free and Open Source…
• … Document and Graph Store…
• … with embedded JavaScript…
• … and an amazing query language
/
(~(
) ) /_/
( _-----_(@ @)
(  /
/|/--| V
" " " "
• … a feature of ArangoDB since 1.4
• … an easy way to define REST APIs on top of
ArangoDB
• … a toolset for developing your single page
web application
• … not requiring any special code on the client
side – use it with Angular, Backbone,
Ember,…
Foxx is…
Why another solution?
• ArangoDB Foxx is streamlined for API
creation – not a Jack of all trades
• There‘s no communication overhead
between (serverside) application and
database
• It is designed for front end developers: Use
JavaScript, you already know that
Live Coding
Controller
var FoxxApplication = require("org/arangodb/foxx").Controller;
var controller = new FoxxApplication(applicationContext);
var db = require("internal").db;
var Heroes = require("repositories/heroes").Repository;
var Hero = require("models/hero").Model;
var heroes = new Heroes(db.heroes, Hero);
/** Load random
*
* Load a random hero
*/
controller.get("random", function(req, res) {
res.json(heroes.random());
});
/** Load hero
*
* Load a specific hero
*/
controller.get("superheroes/:id", function(req, res) {
res.json(heroes.byId(req.params("id")).forClient());
}).pathParam("id", {
type: "string",
description: "The key value of a hero"
});
/** Replace a hero
*
* replace a hero with new values
*/
controller.put("superheroes/:id", function(req, res) {
var hero = req.params("hero");
if(hero.get("_key") !== req.params("id")) {
throw new Error("Id missmatch");
}
heroes.replace(hero);
res.json(hero);
}).pathParam("id", {
type: "string",
description: "The key value of a hero"
}).bodyParam("hero", "The new values for a hero", Hero)
.errorResponse(Error, 400, "Id missmatch");
Foxx.Repository and
Foxx.Model
Domain Models Persistence
Foxx.Model Foxx.Repository
Foxx.Model Foxx.Repository
• Representation of the data
• Convenience Methods
• Validation
• Save and Retrieve Data
• Simple Queries
• Define your own queries
Why this separation?
• It doesn‘t violate the SRP like ActiveRecord
• In a lot of cases you can use the standard
Repository or Model and don‘t need your own
• It‘s great for testing
• You can mock the collection and the model
prototype to test your Repository
• You don‘t need to mock anything to test
your model
Live Coding
Model & Repository
Modelvar Foxx = require("org/arangodb/foxx");
var Hero = Foxx.Model.extend({
// instance properties
},{
attributes: {
"_id": "string",
"_key": "string",
"name": "string",
"comment": "string"
}
});
exports.Model = Hero;
Repository
var Foxx = require("org/arangodb/foxx");
var Heroes = Foxx.Repository.extend({
random: function() {
return this.collection.any()._key;
}
});
exports.Repository = Heroes;
Thanks
• Please try ArangoDB Foxx
• www.arangodb.org
• We to get feedback
Contact
• mchacki@arangodb.org
• @mchacki on Twitter
Thanks
• First Slide version by Lucas Dohmen
• Andreas Streichardt and Julian Steiner for
giving an AngularJS & Foxx Training with me
and elaborating the Idea for the App
• Database icon designed by Romeo Barreto
from The Noun Project
• Logos from Node.js, Ruby on Rails, Django,
AngularJS and Symfony from the respective
projects
• All other icons are from Font Awesome

Weitere ähnliche Inhalte

Was ist angesagt?

サーバーサイドから見るGraphQL Serverless Meetup #19
サーバーサイドから見るGraphQL Serverless Meetup #19サーバーサイドから見るGraphQL Serverless Meetup #19
サーバーサイドから見るGraphQL Serverless Meetup #19Yutaka Tachibana
 
A Practical Guide To Hypermedia APIs - Philly.rb
A Practical Guide To Hypermedia APIs - Philly.rbA Practical Guide To Hypermedia APIs - Philly.rb
A Practical Guide To Hypermedia APIs - Philly.rbSmartLogic
 
Rapi::Blog talk - TPC 2017
Rapi::Blog talk - TPC 2017Rapi::Blog talk - TPC 2017
Rapi::Blog talk - TPC 2017Henry Van Styn
 
SharePoint Framework, React, and Office UI Fabric spc adriatics 2016
SharePoint Framework, React, and Office UI Fabric spc adriatics 2016SharePoint Framework, React, and Office UI Fabric spc adriatics 2016
SharePoint Framework, React, and Office UI Fabric spc adriatics 2016Sonja Madsen
 
SharePoint 2013 APIs
SharePoint 2013 APIsSharePoint 2013 APIs
SharePoint 2013 APIsJohn Calvert
 
RapidApp - YAPC::NA 2014
RapidApp - YAPC::NA 2014RapidApp - YAPC::NA 2014
RapidApp - YAPC::NA 2014Henry Van Styn
 
Jasig rubyon rails
Jasig rubyon railsJasig rubyon rails
Jasig rubyon rails_zaMmer_
 
At Begin, URL Handling and REST
At Begin, URL Handling and RESTAt Begin, URL Handling and REST
At Begin, URL Handling and RESTBrian Loomis
 
YiiConf 2012 - Alexander Makarov - Yii2, what's new
YiiConf 2012 - Alexander Makarov - Yii2, what's newYiiConf 2012 - Alexander Makarov - Yii2, what's new
YiiConf 2012 - Alexander Makarov - Yii2, what's newAlexander Makarov
 
A Persistence Service for the OSGi Framework - Carl Rosenberger, Chief Softwa...
A Persistence Service for the OSGi Framework - Carl Rosenberger, Chief Softwa...A Persistence Service for the OSGi Framework - Carl Rosenberger, Chief Softwa...
A Persistence Service for the OSGi Framework - Carl Rosenberger, Chief Softwa...mfrancis
 
I18nize Scala programs à la gettext
I18nize Scala programs à la gettextI18nize Scala programs à la gettext
I18nize Scala programs à la gettextNgoc Dao
 
The JSON REST API for WordPress
The JSON REST API for WordPressThe JSON REST API for WordPress
The JSON REST API for WordPressTaylor Lovett
 
Introduction to the SharePoint 2013 REST API
Introduction to the SharePoint 2013 REST APIIntroduction to the SharePoint 2013 REST API
Introduction to the SharePoint 2013 REST APISparkhound Inc.
 
Introduction to CouchDB
Introduction to CouchDBIntroduction to CouchDB
Introduction to CouchDBOpusVL
 
Ei cakephp
Ei cakephpEi cakephp
Ei cakephpeiei lay
 
Apache Cayenne: a Java ORM Alternative
Apache Cayenne: a Java ORM AlternativeApache Cayenne: a Java ORM Alternative
Apache Cayenne: a Java ORM AlternativeAndrus Adamchik
 
Building Beautiful REST APIs in ASP.NET Core
Building Beautiful REST APIs in ASP.NET CoreBuilding Beautiful REST APIs in ASP.NET Core
Building Beautiful REST APIs in ASP.NET CoreNate Barbettini
 

Was ist angesagt? (20)

サーバーサイドから見るGraphQL Serverless Meetup #19
サーバーサイドから見るGraphQL Serverless Meetup #19サーバーサイドから見るGraphQL Serverless Meetup #19
サーバーサイドから見るGraphQL Serverless Meetup #19
 
A Practical Guide To Hypermedia APIs - Philly.rb
A Practical Guide To Hypermedia APIs - Philly.rbA Practical Guide To Hypermedia APIs - Philly.rb
A Practical Guide To Hypermedia APIs - Philly.rb
 
Rapi::Blog talk - TPC 2017
Rapi::Blog talk - TPC 2017Rapi::Blog talk - TPC 2017
Rapi::Blog talk - TPC 2017
 
SharePoint Framework, React, and Office UI Fabric spc adriatics 2016
SharePoint Framework, React, and Office UI Fabric spc adriatics 2016SharePoint Framework, React, and Office UI Fabric spc adriatics 2016
SharePoint Framework, React, and Office UI Fabric spc adriatics 2016
 
SharePoint 2013 APIs
SharePoint 2013 APIsSharePoint 2013 APIs
SharePoint 2013 APIs
 
RapidApp - YAPC::NA 2014
RapidApp - YAPC::NA 2014RapidApp - YAPC::NA 2014
RapidApp - YAPC::NA 2014
 
Jasig rubyon rails
Jasig rubyon railsJasig rubyon rails
Jasig rubyon rails
 
At Begin, URL Handling and REST
At Begin, URL Handling and RESTAt Begin, URL Handling and REST
At Begin, URL Handling and REST
 
Introduction to Monsoon PHP framework
Introduction to Monsoon PHP frameworkIntroduction to Monsoon PHP framework
Introduction to Monsoon PHP framework
 
YiiConf 2012 - Alexander Makarov - Yii2, what's new
YiiConf 2012 - Alexander Makarov - Yii2, what's newYiiConf 2012 - Alexander Makarov - Yii2, what's new
YiiConf 2012 - Alexander Makarov - Yii2, what's new
 
A Persistence Service for the OSGi Framework - Carl Rosenberger, Chief Softwa...
A Persistence Service for the OSGi Framework - Carl Rosenberger, Chief Softwa...A Persistence Service for the OSGi Framework - Carl Rosenberger, Chief Softwa...
A Persistence Service for the OSGi Framework - Carl Rosenberger, Chief Softwa...
 
In app search 1
In app search 1In app search 1
In app search 1
 
I18nize Scala programs à la gettext
I18nize Scala programs à la gettextI18nize Scala programs à la gettext
I18nize Scala programs à la gettext
 
The JSON REST API for WordPress
The JSON REST API for WordPressThe JSON REST API for WordPress
The JSON REST API for WordPress
 
Introduction to the SharePoint 2013 REST API
Introduction to the SharePoint 2013 REST APIIntroduction to the SharePoint 2013 REST API
Introduction to the SharePoint 2013 REST API
 
Introduction to CouchDB
Introduction to CouchDBIntroduction to CouchDB
Introduction to CouchDB
 
Cakeph pppt
Cakeph ppptCakeph pppt
Cakeph pppt
 
Ei cakephp
Ei cakephpEi cakephp
Ei cakephp
 
Apache Cayenne: a Java ORM Alternative
Apache Cayenne: a Java ORM AlternativeApache Cayenne: a Java ORM Alternative
Apache Cayenne: a Java ORM Alternative
 
Building Beautiful REST APIs in ASP.NET Core
Building Beautiful REST APIs in ASP.NET CoreBuilding Beautiful REST APIs in ASP.NET Core
Building Beautiful REST APIs in ASP.NET Core
 

Ähnlich wie Building a spa_in_30min

FOXX - a Javascript application framework on top of ArangoDB
FOXX - a Javascript application framework on top of ArangoDBFOXX - a Javascript application framework on top of ArangoDB
FOXX - a Javascript application framework on top of ArangoDBArangoDB Database
 
Spring 3 - An Introduction
Spring 3 - An IntroductionSpring 3 - An Introduction
Spring 3 - An IntroductionThorsten Kamann
 
RSpec on Rails Tutorial
RSpec on Rails TutorialRSpec on Rails Tutorial
RSpec on Rails TutorialWen-Tien Chang
 
Crafting Evolvable Api Responses
Crafting Evolvable Api ResponsesCrafting Evolvable Api Responses
Crafting Evolvable Api Responsesdarrelmiller71
 
Azure for SharePoint Developers - Workshop - Part 2: Azure Functions
Azure for SharePoint Developers - Workshop - Part 2: Azure FunctionsAzure for SharePoint Developers - Workshop - Part 2: Azure Functions
Azure for SharePoint Developers - Workshop - Part 2: Azure FunctionsBob German
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajaxNir Elbaz
 
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte FrühlingSpring 3 - Der dritte Frühling
Spring 3 - Der dritte FrühlingThorsten Kamann
 
SproutCore and the Future of Web Apps
SproutCore and the Future of Web AppsSproutCore and the Future of Web Apps
SproutCore and the Future of Web AppsMike Subelsky
 
Scalable web application architecture
Scalable web application architectureScalable web application architecture
Scalable web application architecturepostrational
 
MongoDB at ZPUGDC
MongoDB at ZPUGDCMongoDB at ZPUGDC
MongoDB at ZPUGDCMike Dirolf
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...Fabio Franzini
 
Using Ruby on Rails with legacy Oracle databases
Using Ruby on Rails with legacy Oracle databasesUsing Ruby on Rails with legacy Oracle databases
Using Ruby on Rails with legacy Oracle databasesRaimonds Simanovskis
 
Spark r under the hood with Hossein Falaki
Spark r under the hood with Hossein FalakiSpark r under the hood with Hossein Falaki
Spark r under the hood with Hossein FalakiDatabricks
 
前端MVC之BackboneJS
前端MVC之BackboneJS前端MVC之BackboneJS
前端MVC之BackboneJSZhang Xiaoxue
 
Mongo db washington dc 2014
Mongo db washington dc 2014Mongo db washington dc 2014
Mongo db washington dc 2014ikanow
 
Tools that get you laid
Tools that get you laidTools that get you laid
Tools that get you laidSwizec Teller
 
初心者向けGAE/Java説明資料
初心者向けGAE/Java説明資料初心者向けGAE/Java説明資料
初心者向けGAE/Java説明資料Shinichi Ogawa
 

Ähnlich wie Building a spa_in_30min (20)

FOXX - a Javascript application framework on top of ArangoDB
FOXX - a Javascript application framework on top of ArangoDBFOXX - a Javascript application framework on top of ArangoDB
FOXX - a Javascript application framework on top of ArangoDB
 
Spring 3 - An Introduction
Spring 3 - An IntroductionSpring 3 - An Introduction
Spring 3 - An Introduction
 
RSpec on Rails Tutorial
RSpec on Rails TutorialRSpec on Rails Tutorial
RSpec on Rails Tutorial
 
Crafting Evolvable Api Responses
Crafting Evolvable Api ResponsesCrafting Evolvable Api Responses
Crafting Evolvable Api Responses
 
Azure for SharePoint Developers - Workshop - Part 2: Azure Functions
Azure for SharePoint Developers - Workshop - Part 2: Azure FunctionsAzure for SharePoint Developers - Workshop - Part 2: Azure Functions
Azure for SharePoint Developers - Workshop - Part 2: Azure Functions
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
 
Gaej For Beginners
Gaej For BeginnersGaej For Beginners
Gaej For Beginners
 
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte FrühlingSpring 3 - Der dritte Frühling
Spring 3 - Der dritte Frühling
 
REST easy with API Platform
REST easy with API PlatformREST easy with API Platform
REST easy with API Platform
 
Real World MVC
Real World MVCReal World MVC
Real World MVC
 
SproutCore and the Future of Web Apps
SproutCore and the Future of Web AppsSproutCore and the Future of Web Apps
SproutCore and the Future of Web Apps
 
Scalable web application architecture
Scalable web application architectureScalable web application architecture
Scalable web application architecture
 
MongoDB at ZPUGDC
MongoDB at ZPUGDCMongoDB at ZPUGDC
MongoDB at ZPUGDC
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
Using Ruby on Rails with legacy Oracle databases
Using Ruby on Rails with legacy Oracle databasesUsing Ruby on Rails with legacy Oracle databases
Using Ruby on Rails with legacy Oracle databases
 
Spark r under the hood with Hossein Falaki
Spark r under the hood with Hossein FalakiSpark r under the hood with Hossein Falaki
Spark r under the hood with Hossein Falaki
 
前端MVC之BackboneJS
前端MVC之BackboneJS前端MVC之BackboneJS
前端MVC之BackboneJS
 
Mongo db washington dc 2014
Mongo db washington dc 2014Mongo db washington dc 2014
Mongo db washington dc 2014
 
Tools that get you laid
Tools that get you laidTools that get you laid
Tools that get you laid
 
初心者向けGAE/Java説明資料
初心者向けGAE/Java説明資料初心者向けGAE/Java説明資料
初心者向けGAE/Java説明資料
 

Kürzlich hochgeladen

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 

Kürzlich hochgeladen (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

Building a spa_in_30min

  • 2. Michael Hackstein @mchacki • Member of ArangoDB Core Team • web front-end • graph features • Organizer of cologne.js • Master’s Degree
 (spec. Databases and
 Information Systems)
  • 4. The Idea • What if we could talk to the database directly? • It would only need an API • What if we could define this API in JavaScript?
  • 5. Single Page Web Applications This doesn‘t mean its a Rails/… Killer
  • 8. What is ? • Free and Open Source… • … Document and Graph Store… • … with embedded JavaScript… • … and an amazing query language
  • 9. / (~( ) ) /_/ ( _-----_(@ @) ( / /|/--| V " " " "
  • 10. • … a feature of ArangoDB since 1.4 • … an easy way to define REST APIs on top of ArangoDB • … a toolset for developing your single page web application • … not requiring any special code on the client side – use it with Angular, Backbone, Ember,… Foxx is…
  • 11. Why another solution? • ArangoDB Foxx is streamlined for API creation – not a Jack of all trades • There‘s no communication overhead between (serverside) application and database • It is designed for front end developers: Use JavaScript, you already know that
  • 13. var FoxxApplication = require("org/arangodb/foxx").Controller; var controller = new FoxxApplication(applicationContext); var db = require("internal").db; var Heroes = require("repositories/heroes").Repository; var Hero = require("models/hero").Model; var heroes = new Heroes(db.heroes, Hero); /** Load random * * Load a random hero */ controller.get("random", function(req, res) { res.json(heroes.random()); }); /** Load hero * * Load a specific hero */ controller.get("superheroes/:id", function(req, res) { res.json(heroes.byId(req.params("id")).forClient()); }).pathParam("id", { type: "string", description: "The key value of a hero" }); /** Replace a hero * * replace a hero with new values */ controller.put("superheroes/:id", function(req, res) { var hero = req.params("hero"); if(hero.get("_key") !== req.params("id")) { throw new Error("Id missmatch"); } heroes.replace(hero); res.json(hero); }).pathParam("id", { type: "string", description: "The key value of a hero" }).bodyParam("hero", "The new values for a hero", Hero) .errorResponse(Error, 400, "Id missmatch");
  • 16. Foxx.Model Foxx.Repository • Representation of the data • Convenience Methods • Validation • Save and Retrieve Data • Simple Queries • Define your own queries
  • 17. Why this separation? • It doesn‘t violate the SRP like ActiveRecord • In a lot of cases you can use the standard Repository or Model and don‘t need your own • It‘s great for testing • You can mock the collection and the model prototype to test your Repository • You don‘t need to mock anything to test your model
  • 18. Live Coding Model & Repository
  • 19. Modelvar Foxx = require("org/arangodb/foxx"); var Hero = Foxx.Model.extend({ // instance properties },{ attributes: { "_id": "string", "_key": "string", "name": "string", "comment": "string" } }); exports.Model = Hero;
  • 20. Repository var Foxx = require("org/arangodb/foxx"); var Heroes = Foxx.Repository.extend({ random: function() { return this.collection.any()._key; } }); exports.Repository = Heroes;
  • 21. Thanks • Please try ArangoDB Foxx • www.arangodb.org • We to get feedback
  • 23. Thanks • First Slide version by Lucas Dohmen • Andreas Streichardt and Julian Steiner for giving an AngularJS & Foxx Training with me and elaborating the Idea for the App • Database icon designed by Romeo Barreto from The Noun Project • Logos from Node.js, Ruby on Rails, Django, AngularJS and Symfony from the respective projects • All other icons are from Font Awesome