Fetching data from your database

Hi! I’m currently working on a very simple app where people sign up, select items to purchase, and pay. I’m also working on a nextjs non adalo app that needs to fetch the data from this database for a variety of reasons. Does anyone know how to do this?

This may be of help to you, though last I checked their API may not be quite configured yet to do this; but it’s a good starting point. You may also be able to use services like Zapier or Integromat to do what you’re wanting. Hope it helps.

I’ve been working on my own project and wanting to pull in the data from Adalo, but their API is completely useless.

You can only pull an entire collection, or a single record from a collection, but you can only query it by the ID directly.

So that means you have to pull the entire collection, parse the data, query it for the data you want, say you’re looking for a name → check that against the collection, then submit another API call to that specific entry.

They have no built in methods like normal databases do such as mongoDB’s find() queries to search for what you want. You can only pull everything at once, or one item but only by ID. Totally useless.

What I did was set up Express, fetch, ejs to mess around with this.
I made an object with some of my collection endpoints to test with.

set up a button on a page to send a request to my back end express which then made the API calls.

Here’s an example:

const getCollection = async (collection) => {
    //check to make sure the collection is in my list
    if (collectionEndpoints.hasOwnProperty(collection)) {
        console.log("collection found")
        try {
            const response = await fetch(`${adaloEndpointURL}${collectionEndpoints[collection]}`, {
                method: "GET",
                headers: adaloRequestHeader
            })
            return await response.json()
        } catch (error) {
            console.log(error)
        }
    } console.log("Collection not found")
}


app.post('/getCollection', async (req, res) => {
    const collection = req.body.collection.toLowerCase()
    const collectionData = await getCollection(collection)
    console.log(collectionData)
    res.redirect('/')
})

The express route calls the function to fetch the data and logs the results to the console. I could then manipulate them further from there if I want to like create another array object containing just “ID” “Name” and “email” for future reference, then I could search that local array object for an ID for a single query if I wanted to.

Working with Adalo has been so bad that I have actually given up in favour of continuing my course and learning how to build what I want myself. Adalo is just so janky and limited.