CenterForDigitalHumanities / TPEN-services

Services required by TPEN interfaces in order to interact with data
1 stars 0 forks source link

A less expensive TinyController.connected() #86

Open thehabes opened 4 months ago

thehabes commented 4 months ago

Current (4/1/24)

/** 
 * Generally check that the TinyPEN API is running.
 * Perform a query for an object we know is there.
 * @return boolean
 * */
async connected() {
    // Send a /query to ping TinyPen
    try{
        // FIXME something less expensive
        const theone = await this.find({ "_id": "11111" })
        return theone.length === 1    
    } catch(err){
        console.error(err)
        return false
    }
}

Is it possible to do something less expensive, such as a HEAD request of some kind instead?