home shape

Cheerio with Node.js and CoffeeScript | ArangoDB Tutorial

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.

Frank Celler

Frank Celler

Frank is both entrepreneur and backend developer, developing mostly memory databases for two decades. He is the CTO and co-founder of ArangoDB. Try to challenge Frank asking him questions on C, C++ and MRuby. Besides Frank organizes Cologne’s NoSQL group & is an active member of NoSQL community.

2 Comments

  1. Patrick Mulder on February 13, 2014 at 2:46 pm

    Nice! I am using https://github.com/petkaantonov/bluebird and https://github.com/jashkenas/underscore in my side projects. It might be interesting to get some support for metrics too, and/or cryptography (sha calculations, etc). If you think to render HTML out of Foxx, maybe Ejs or Handlebars.js might be interesting.

  2. Patrick Mulder on February 13, 2014 at 2:50 pm

    It might be interesting to make Foxx applications somewhat compatible with Node.js projects such as: http://keystonejs.com/ and https://ghost.org/ – in their package.json there should be some interesting stuff.

Leave a Comment





Get the latest tutorials, blog posts and news: