Foxx apps debugging workflow?

631 views Asked by At

What is the recommended workflow to debug Foxx applications?

I am currently working on a pretty big application and it seems to me I am doing something wrong, because the way I am proceeding does not seem to be maintanable at all:

  1. Do your changes in Foxx app (eg new endpoints).
  2. Upload your foxx app to ArangoDB.
  3. Test your changes (eg trigger API calls).
  4. Check the logs to see if something went wrong.
  5. Go to 1.
2

There are 2 answers

1
Claudio Huyskens On

i experienced great time savings, shifting more of the development workflow to the terminal client 'arangosh'. Especially when debugging more complex endpoints, you can isolate queries and functions and debug each individually in the terminal. When done debugging, you merge your code in Foxx app and mount it. Require modules as you would do in Foxx, just enter variables as arguments for your functions or queries.

You can use arangosh either directly from the terminal or via the embedded terminal in the Arangodb frontend.

You may also save some time switching to dev mode, which allows you to have changes in your code directly reflected in the mounted app without fetching, mounting and unmounting each time. That additional flexibility costs some performance, so make sure to switch back to production mode once your Foxx app is ready for deployment.

0
moonglum On

When developing a Foxx App, I would suggest using the development mode. This also helps a lot with debugging, as you have faster feedback. This works as follows:

  1. Start arangod with the dev-app-path option like this: arangod --javascript.dev-app-path /PATH/TO/FOXX_APPS /PATH/TO/DB, where the path to foxx apps is the folder that contains a database folder that contains your foxx apps sorted by database. More information can be found here.
  2. Make your changes, no need to deploy the app or anything. The app now automatically reloads on every request. Change, try out, change try out...

There's currently no debugging capabilities. We are planning to add more support for unit testing of Foxx apps in the near future, so you can have a more TDD-like workflow.