Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nebhale/client-nodejs
Service Bindings for Kubernetes NodeJS Client
https://github.com/nebhale/client-nodejs
nodejs
Last synced: about 2 months ago
JSON representation
Service Bindings for Kubernetes NodeJS Client
- Host: GitHub
- URL: https://github.com/nebhale/client-nodejs
- Owner: nebhale
- License: apache-2.0
- Created: 2021-08-20T19:52:25.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-28T12:04:27.000Z (2 months ago)
- Last Synced: 2024-10-28T15:29:19.166Z (2 months ago)
- Topics: nodejs
- Language: TypeScript
- Homepage:
- Size: 707 KB
- Stars: 0
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# client-nodejs
[![Tests](https://github.com/nebhale/client-nodejs/workflows/Tests/badge.svg?branch=main)](https://github.com/nebhale/client-nodejs/actions/workflows/tests.yaml)
[![codecov](https://codecov.io/gh/nebhale/client-nodejs/branch/main/graph/badge.svg)](https://codecov.io/gh/nebhale/client-nodejs)`client-nodejs` is a library to access [Service Binding Specification for Kubernetes](https://k8s-service-bindings.github.io/spec/) conformant Service Binding [Workload Projections](https://k8s-service-bindings.github.io/spec/#workload-projection).
## Example
```ts
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](./LICENSE) for details.