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.
2 Comments
Leave a Comment
Get the latest tutorials, blog posts and news:
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.
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.