Search code examples
node.jsclient-serverfrontendarangodbarangojs

Querying ArangoDB without leaving page


I'm relatively new to webdevelopment and have been using ArangoDB for most of that limited experience. I have a basic understanding of Node.js and creating express based CRUD apps with ArangoDB as the database.

I'm getting to a point though where I'd like to have the ability to query the database from inside the client. Say I would like to have a datalist-type element where the user types words into a searchbar. I'd like the ability to query the database from there rather than having to query the database for all of its files prior to creating the datalist. I have not found a single mention though of using database queries from the client side. I can't imagine that this is not possible. Surely when I search wikipedia through the search bar and it provides me with options I didn't just receive the entire wikipedia documents list upon loading the page? Please steer me in the right direction, I don't know how to tackle this problem.


Solution

  • Have a look at how to build dynamic forms, this will allow you to perform AJAX style calls from the browser window to a back end REST API service. This will allow your back end web service to gather the data for the response (from ArangoDB if required), and respond with that data, most likely in a JSON format.

    Your UI can then take that response and dynamically update components in your DOM so that the user can see the data injected into the page without a page reload action taking place.

    https://www.pluralsight.com/search?q=ajax is a great place to start.

    Alternatively you can have a look at free content like https://www.youtube.com/watch?v=tNKD0kfel6o