FOXX - a Javascript application framework on top of ArangoDB
-
Upload
arangodb -
Category
Technology
-
view
25.237 -
download
7
description
Transcript of FOXX - a Javascript application framework on top of ArangoDB
![Page 1: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/1.jpg)
RWTH Aachen, Computer Science Student on branch mastertriAGENS GmbH, Developer
moon!lum moonbeamlabs
by Lucas DohmenCreate APIs on your database
Aran!oDB Foxx
![Page 2: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/2.jpg)
Sin!le Pa!eWeb Applications
![Page 3: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/3.jpg)
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?
![Page 4: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/4.jpg)
Sin!le Pa!eWeb Applications
![Page 5: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/5.jpg)
Sin!le Pa!eWeb Applications
This doesn‘t mean its a Rails/… Killer
![Page 6: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/6.jpg)
Client Server DB
![Page 7: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/7.jpg)
Client Server DBwith Foxx
![Page 8: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/8.jpg)
Who is that !uy?
• Aran!oDB Core Team
• Aran!oDB Foxx & Ruby Adapter
• Student on the master branch
• hacken.in & nerdkun.de
![Page 9: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/9.jpg)
Who is that !uy?
• Aran!oDB Core Team
• Aran!oDB Foxx & Ruby Adapter
• Student on the master branch
• hacken.in & nerdkun.de
/\(~( ) ) /\_/\( _-----_(@ @) ( \ / /|/--\|\ V " " " "
![Page 10: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/10.jpg)
What is ?
• Free and Open Source…
• … Document and Graph Store…
• … with embedded JavaScript…
• … and an amazin! query lan!ua!e
More about Aran!oDB at
Ruby UG Munich next week
![Page 11: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/11.jpg)
/\(~( ) ) /\_/\( _-----_(@ @) ( \ / /|/--\|\ V " " " "
![Page 12: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/12.jpg)
• …a feature of Aran!oDB 1.4 (currently in alpha, release: End of September)
• …an easy way to define REST APIs on top of Aran!oDB
• … a toolset for developin! your sin!le pa!e web application
• … not requirin! any special code on the client side – use it with Backbone, Ember, An!ular…
Foxx is…
![Page 13: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/13.jpg)
Why another solution?
• Aran!oDB Foxx is streamlined for API creation – not a Jack of all trades
• There‘s no communication overhead between (serverside) application and database
• It is desi!ned for front end developers: Use JavaScript, you already know that
![Page 14: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/14.jpg)
Foxx.Controller
![Page 15: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/15.jpg)
Foxx = require("org/arangodb/foxx");
controller = new Foxx.Controller(appContext);
controller.get("/users", function(req, res) { res.json({ hello: "world" });});
![Page 16: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/16.jpg)
Parameterizethe routes
• You may want a route like `users/:id`…
• …and then access the value of `id` easily
![Page 17: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/17.jpg)
Foxx = require("org/arangodb/foxx");
controller = new Foxx.Controller(appContext);
controller.get("/users ", function(req, res) { res.json({ hello: });});
req.params("name");
/:name
![Page 18: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/18.jpg)
• In your Foxx.Controller you describe your routes
• But your application can consist of multiple Foxx.Controllers
• … and you also want to deliver assets and files
Manifest.json
![Page 19: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/19.jpg)
{ "name": "my_website", "version": "1.2.1", "description": "My Website with a blog and a shop", "thumbnail": "images/website-logo.png",
"controllers": { "/blog": "apps/blog.js", "/shop": "apps/shop.js" },
"assets": { "application.js": { "files": [ "vendor/jquery.js", "assets/javascripts/*" ] } }}
![Page 20: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/20.jpg)
More
• Define a setup and teardown function to create and delete collections
• Define lib to set a base path for your require statements
• Define files to deliver binary data unaltered
![Page 21: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/21.jpg)
Documentationas a first class citizen
![Page 22: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/22.jpg)
Annotate your Routes
• For Documentation
• But it is also used for validation
![Page 23: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/23.jpg)
controller.get("/users/:name", function(req, res) { res.json({ hello: req.params("name"); });}) .pathParam("name", { description: "Name of the User", dataType: "string"});
/** What's my name? * * This route knows it. */
![Page 24: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/24.jpg)
Automatically !enerateSwa!!er Docs
![Page 25: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/25.jpg)
Models & Repositories
• Foxx also helps you structure the M part of MVC
• We don‘t have time for that today
• But you can see a demonstration in our demo app
• … or come to me later ;)
![Page 26: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/26.jpg)
Foxx Apps Repo
• Look at demo applications
• Install components from a central repository
• Share your ideas
![Page 27: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/27.jpg)
Foxx Demo App:Aye-Aye
![Page 28: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/28.jpg)
Foxx Authenticationhttps://!ithub.com/moon!lum/foxx_authentication
![Page 29: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/29.jpg)
Foxx:The Future
![Page 30: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/30.jpg)
A Glance intothe Future
• Confi!ure filters for your assets:
• U!lifyJS2
• Later: Co"ee, Sass, Client Templates…
• Confi!urable Lo!!in!
• Yo Generator
![Page 31: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/31.jpg)
Thanks
• Please try Aran!oDB Foxx
• We to !et feedback
![Page 32: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/32.jpg)
Contact
• lucas@aran!odb.or!
• @moonbeamlabs on Twitter
![Page 33: FOXX - a Javascript application framework on top of ArangoDB](https://reader034.fdocuments.us/reader034/viewer/2022042513/540006018d7f7261088b4976/html5/thumbnails/33.jpg)
Thanks
• Database icon desi!ned by Romeo Barreto from The Noun Project
• Browser icon desi!ned by Fernando Vasconcelos from The Noun Project
• Lo!os from Node.js, Ruby on Rails, Djan!o and Symfony from the respective projects
• All other icons are from Font Awesome