Skip to content

nebhale/client-nodejs

Folders and files

NameName
Last commit message
Last commit date
Oct 24, 2023
Aug 24, 2021
Aug 20, 2021
Jul 25, 2022
Jul 9, 2024
Aug 20, 2021
Aug 24, 2021
Aug 20, 2021
Aug 21, 2021
Jul 9, 2024
Jul 9, 2024
Jul 9, 2024
Jul 9, 2024
Jul 9, 2024
Mar 18, 2025
Dec 3, 2024
Jul 9, 2024
Aug 23, 2021
Jul 9, 2024

Repository files navigation

client-nodejs

Tests codecov

client-nodejs is a library to access Service Binding Specification for Kubernetes conformant Service Binding Workload Projections.

Example

import * as Bindings from 'bindings'
import { Pool } from 'pg'

async function main() {
    let b = await Bindings.fromServiceBindingRoot()
    b = await Bindings.filter(b, 'postgresql')
    if (b == undefined || b.length != 1) {
        throw Error(`Incorrect number of PostgreSQL drivers: ${b == undefined ? "0" : b.length}`)
    }

    const u = await Bindings.get(b[0], 'url')
    if (u == undefined) {
        throw Error('No URL in binding')
    }

    const conn = new Pool({connectionString: u})

    // ...
}

License

Apache License v2.0: see LICENSE for details.