33
RWTH Aachen, Computer Science Student on branch master triAGENS GmbH, Developer moonlum moonbeamlabs by Lucas Dohmen Create APIs on your database AranoDB Foxx

FOXX - a Javascript application framework on top of ArangoDB

  • Upload
    arangodb

  • View
    25.245

  • Download
    7

Embed Size (px)

DESCRIPTION

Foxx allows you to build APIs directly on top of the database ArangoDB in Javascript and therefore skip the middleman (Rails, Django, Symfony or whatever your favorite web framework is). Foxx is designed with simplicity and the specific use case of modern client-side MVC frameworks in mind.

Citation preview

Page 1: FOXX - a Javascript application framework on top of ArangoDB

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

Sin!le Pa!eWeb Applications

Page 3: FOXX - a Javascript application framework on top of ArangoDB

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

Sin!le Pa!eWeb Applications

Page 5: FOXX - a Javascript application framework on top of ArangoDB

Sin!le Pa!eWeb Applications

This doesn‘t mean its a Rails/… Killer

Page 6: FOXX - a Javascript application framework on top of ArangoDB

Client Server DB

Page 7: FOXX - a Javascript application framework on top of ArangoDB

Client Server DBwith Foxx

Page 8: FOXX - a Javascript application framework on top of ArangoDB

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

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

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

/\(~( ) ) /\_/\( _-----_(@ @) ( \ / /|/--\|\ V " " " "

Page 12: FOXX - a Javascript application framework on top of ArangoDB

• …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

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

Foxx.Controller

Page 15: FOXX - a Javascript application framework on top of ArangoDB

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

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

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

• 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

{ "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

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

Documentationas a first class citizen

Page 22: FOXX - a Javascript application framework on top of ArangoDB

Annotate your Routes

• For Documentation

• But it is also used for validation

Page 23: FOXX - a Javascript application framework on top of ArangoDB

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

Automatically !enerateSwa!!er Docs

Page 25: FOXX - a Javascript application framework on top of ArangoDB

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

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

Foxx Demo App:Aye-Aye

Page 28: FOXX - a Javascript application framework on top of ArangoDB

Foxx Authenticationhttps://!ithub.com/moon!lum/foxx_authentication

Page 29: FOXX - a Javascript application framework on top of ArangoDB

Foxx:The Future

Page 30: FOXX - a Javascript application framework on top of ArangoDB

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

Thanks

• Please try Aran!oDB Foxx

• We to !et feedback

Page 32: FOXX - a Javascript application framework on top of ArangoDB

Contact

• lucas@aran!odb.or!

• @moonbeamlabs on Twitter

Page 33: FOXX - a Javascript application framework on top of ArangoDB

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