Testing Foxx with Mocha: ArangoDB Development Insights
Some of the most frequent questions by new programmers learning Foxx have been about testing. While the HTTP API can easily be tested with any HTTP client and any JavaScript code that can be isolated from the ArangoDB APIs could be tested in similar environments like Node.js or io.js, it was all but impossible to test Foxx apps inside ArangoDB.
The upcoming release of ArangoDB sets out to change this. As of version 2.6, ArangoDB Foxx will come with full support for Mocha tests allowing you to use the same test framework for your frontend code in the browser, your server-side code running on Node.js or io.js, and your backend logic in Foxx. (more…)
Foxx console – Logging and querying console messages
Aside from the more noticeable features, ArangoDB 2.5 also added the console
object to the scope of all Foxx app modules. Unlike the object already available by importing the console
module, the Foxx console logs all messages directly to the database.
In addition to allowing you to specify per-application log levels to make sure your debug messages don’t end up cluttering your production database, the API also provides useful extras like optionally logging a full stack trace for every message that is stored as a structured list of objects, making them easy to query using AQL. There’s also a number of convenience methods for querying your application’s log entries from within your Foxx code if you prefer keeping it simple.
console.time('do something');
// ... more code ...
console.time('do more stuff');
// ... even more code ...
console.timeEnd('do more stuff'); // => "do more stuff: 23ms"
// ... a little bit more ....
console.timeEnd('do something'); // => "do something: 52ms"
For more information see the chapter on the Foxx console API in the official ArangoDB documentation.
Monitoring ArangoDB and individual Foxx Apps with collectd
Great to know your database scales and database vendors like ArangoDB add some statistics on node / cluster health directly in their products.
But running a bunch of different servers and applications you need a central hub to collect monitoring data from all services running. In a series of recipes Willi shows how you could easily add monitoring capabilities to NoSQL databases like ArangoDB using collectd with the cURL JSON plugin. (more…)
Securing your Foxx with API Keys
ArangoDB’s Foxx allows you to easily build an API to access your data sources. But now this API is either public or restricted to users having an account, but those still get unlimited access.
In many use cases you do not want to expose your data in this fashion, but you want to expose it with a more controllable access pattern and want to restrict the requests one user could issue in a certain time period. Popular examples for these API restrictions are Twitter or Facebook. This allows you to offer all of your data but only in limited chunks, and then possibly charge your customers to increase the chunk limit they can request.
All this is done via API keys, which are bound to a user and has become a common pattern to monetize the data you have collected. (more…)
Exploring More ES6 Features: ArangoDB Insights
ArangoDB 2.5 comes with an upgraded version of V8, Google’s open source JavaScript engine.
The built-in version of V8 has been upgraded from 3.29.54 to 3.31.74.1.
In addition to several already usable ES6 features (detailed in this blog, the following ES6 features are activated in ArangoDB 2.5 by default:
- iterators and generators
- template strings
- enhanced object literals
- enhanced numeric literals
- block scoping with
let
andconstant
variables using const - additional String methods (such as
startsWith
,repeat
etc.)
The above features are available in ArangoDB 2.5, and can now be used for scripting purposes in the ArangoShell and in server-side Foxx actions inside the database.
This blog post briefly explains the features provides some quick examples for using them.
New Foxx Debugging Preview: ArangoDB Updates
We are working hard to improve usability and simplify the usage of Foxx which will be shipped with version 2.5. of ArangoDB.
We have learned from the past and collected a lot of feedback, thanks to all people using Foxx already. It helped us to identify the following three important areas of Foxx that should be improved:
- Debugging of Foxx apps
- Getting started with Foxx
- Development Mode
(more…)
Building a self-learning game with ArangoDB, io.js & AngularJS in half a day.
With the ArangoDB Foxx Microservice Framework we’ve introduced an easy way to create a Web API right on top of the NoSQL database.
In early January Max challenged Andreas (AngularJS / NodeJS) that they could build a full-stack application within half a day.
The web application – in short – is a guessing game, in which the computer tries to guess a thing or animal you think of by asking a series of questions, for which you provide the answers. (more…)
Foxx SendGrid Integration: ArangoDB Tutorial
ArangoDB Foxx allows defining job queues that let you perform slow or expensive actions asynchronously.
These queues can be used to send emails, call external APIs or perform other actions that you do not want to perform directly or want to retry on failure. Let’s say you want to send out an email every time you check off an item in your Foxx todo app and you want to use an external transactional email service to do that. (more…)
Crawling GitHub with Promises: ArangoDB Tutorial
The new Javascript driver no longer imposes any promises implementation. It follows the standard callback pattern with a callback using err
and res
.
I wanted to give the new driver a try. A github crawler seemed like a good side-project, especially because the node-github driver follows the same conventions as the Javascript driver.
There are a lot of promise libraries out there. The most popular one – according to NPM – was promises. It should be possible to use any implementation. Therefore I used this one.
ArangoDB Query Builder: Simplifying Database Queries
The most powerful way to query your data in ArangoDB is by using ArangoDB’s own query language, AQL. In the past using AQL in your JavaScript code sadly would often require writing long, unwieldy strings. This made writing complex queries difficult and could often lead to subtle syntax errors or mistakes.
The ArangoDB Query Builder (AQB) is a JavaScript node packaged module that provides a fluid API for writing AQL queries in plain JavaScript. And if you’re using ArangoDB 2.3, the aqb
module is already available to your Foxx applications. (more…)
- « Previous
- 1
- 2
- 3
- Next »
Get the latest tutorials,
blog posts and news:
Thanks for subscribing! Please check your email for further instructions.