Cheerio, Node and Coffee-Script

Foxx’ main purpose is to create a beautiful API for your AngularJS, EmberJS or Backbone.js front-end. However, sometimes you want to do more. We, for example, needed to parse some HTML files. ArangoDB is capable of using some Node.js modules, but unfortunately Cheerio was not one of those. One problem was that we did not support loading of JSON data modules. So, this was a good excuse to rewrite the module loader in ArangoDB to make it even more Node.js-friendly. With those improvements, that are currently available in ArangoDB’s devel branch. You can now also “require” a JSON data file. These files must have a filename ending with “.json”. If the filename ends with “.coffee” it is treated as coffee-script file and automatically compiled into JavaScript. A Foxx app can now contain its own “node_modules” directory to include Node modules which it requires. This makes it much easier to deploy a Foxx app.

Posted in Foxx, General, Javascript | 2 Comments

Ideas and Facts from scotland.js in Edinburgh

Test Driven Development I have been one of the lucky attendants of scotland.js in Edinburgh recently. It was a really nice & informative conference, thanks to all people that made it possible. I did really like to see that TDD is reaching the front-end developers finally. A lot of useful tools for this have been presented by James Shore, Bernard Kobos and Sebastian Golasch. In ArangoDB, TDD is in action all day and I am looking forward to improving our front-end testing even further using these awesome tools.   Front-end Development meets NoSQL Furthermore several talks focussing on front-end development have been given, e.g. by Gregor Martynus presenting Hoodie.js. These front-end talks and my discussions with other attendees gave me the impression that front-end developers spend a lot of time deciding which database they should use.

Posted in Community, Foxx, General, Javascript | Leave a comment

Foxx Screencast: Part 2

It has taken some time, but now part 2 of the Foxx Screencast is available. I talk about some more advanced topics of Foxx and also plans for the future.

Posted in Foxx, Javascript | Leave a comment

ArangoDB 1.3.alpha1 and the first Foxx Screencast

Starting today you can install the first Alpha of the upcoming release of ArangoDB version 1.3. Some of the new features are: ArangoDB Foxx: A lightweight way to define APIs directly on top of ArangoDB Traversals: Define traversals to explore your graphs stored in ArangoDB A new and improved Frontend: Featuring a new design and various improvements And more: Multi-Collection transaction support, user defined functions in AQL, more builtin AQL functions and AQL improvements, bug-fixes… ArangoDB Foxx: The first screencast If you want to get a first look at ArangoDB Foxx, you can now see our first screencast. Lucas talks about the motivation and goals of Foxx and introduces you to the basics. A second screencast will follow with more advanced techniques like our Repositories and Models: How to install it? If you are on a Mac and using Homebrew, you can install it now via brew install –devel arangodb. If you are compiling ArangoDB by yourself, checkout the branch 1.3 from github and compile it. if you are using Linux, we have create package for the usual distributions. You can download them from here.

Posted in Foxx, Javascript | Leave a comment

Foxx – a lightweight Javascript application framework for ArangoDB

Edit: From version 1.4 the ArangoDB user manual available online also includes the documentation for FOXX. For the last months we have been working on Foxx – a brand new Javascript framework on top of the upcoming version of the free and open source NoSQL database ArangoDB. Foxx allows you to build APIs directly on top of the database 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. There are a couple of very interesting scenarios for Foxx: You want to build a Single Page Web Application: most of the business logic is in the Javascript frontend. The backend’s most important task is to persist the data and send data to the client plus a bit of auth, modify, validate logic.  In this case ArangoDB plus a Foxx application is all you need as a backend. Another use case is a mobile app either native or HTML5. Again you’ll have most of the logic already in the frontend (the app in this case). With Foxx you can create your API very easily. And as you don’t have a large full-size MVC stack included, your backend will be very, very fast. You might want to consider Foxx even as lightweight, easy-to-learn alternative to Node.js.

Posted in Foxx, Javascript | Leave a comment

Feature Preview: Using CoffeeScript in ArangoDB

In my blog post about npm packages, I tried to use underscore for ArangoDB. I found that the easiest way to archive this, is using the nodes package manager NPM. Node packages and modules follow the Common.JS specification, so they can be used by ArangoDB. Why not try to use the package coffee-script as well? Install it using npm install coffee-script and that’s it. Unfortunately, CoffeeScript use a module “path”, which is not a CommonJS module. I assume that most of the functionality is part or will be part of the module “fs”. The “path.js” from node.js is simple JavaScript code with some references like ‘path.exists is now called `fs.exists`’ Being brave, I simply copied the file into my module path and tried again. The next obstacle is node’s global variable “process”. Luckily, this is only used to check for Windows in the module “path”. Also ignoring the module “vm” used to execute JavaScript code, this allows one to actually load CoffeScript into ArangoDB. arangosh> process = {}; { }   arangosh> var cs = require("coffee-script");   arangosh> cs.compile("a = 1\nopposite = true\na = -a if opposite", {}); (function() { var a, opposite;   a = 1;   opposite = true;   if (opposite) { a = -a; }   }).call(this); So, I can now use CoffeeScript definition within ArangoDB. Some of the loaders must be adjusted to check for both “.js” and “.coffee” files. Afterwards it should be possible, to define an action in CoffeeScript as well as JavaScript.

Posted in General, Javascript | 2 Comments

Feature Preview: Using NPM packages for ArangoDB

ArangoDB follows the Common.JS specification for modules. However, it would be very convenient, if there was an easy way to install a package like “underscore.js”. These package are, for instance, available using NPM. There is a draft for packages on Common.JS which seems to be compatible with NPM. NPM has a neat way of dealing with version conflicts. Basically, it allows multiple versions to exists simultaneously. For example, assume you have 4 packages A, B, C, D. A requires B and C and D, B requires C. Then directory layout might be as follows. node_modules | +- A | | | +- node_modules | | | +- B | | | | | +- node_modules | | | | | +- C (1.0.0) | | | +- C (2.0.0) | +- D Package B will see package C in version 1.0.0, while package A sees package C in version 2.0.0.

Posted in Javascript, nodejs | 4 Comments

Some useful arangosh tips

arangosh, The ArangoDB shell, provides some options that may simplify an ArangoDB user’s life. Some of these options have been added in version 1.1.2, and some options have been around for a while but are probably still less known. It’s time to showcase them.

Posted in Documentation, Javascript | Leave a comment

ArangoDB – using Javascript in the database

Jan was invited as a speaker to “Js.Everywhere” in Paris. He talked about using Javascript in a database, well, ArangoDB, to be precise, giving lots of examples on “actions” and related concepts in ArangoDB. ArangoDB – Using JavaScript in the database from arangodb

Posted in Community, Javascript, Presentation | 1 Comment