https://github.com/caprover/caprover-api
A simple, typed Typescript SDK for the CapRover API.
EXPERIMENTAL - backward compatibility is not guaranteed.
npm install caprover-api
import CapRoverAPI, { CapRoverModels } from 'caprover-api'
const caprover = new CapRoverAPI(
'https://captain.server.demo.caprover.com',
new SimpleAuthenticationProvider(() => {
return Promise.resolve({
password: 'captain42',
otpToken: undefined,
})
})
)
caprover
.getAllNodes()
.then((response) => {
console.log(response)
})
.catch((error) => {
console.log(error)
})caprover.getDiskUsage() returns a CapRoverModels.DiskUsageResponse with
coverage: 'captain-node', node ID/hostname, and total/used/available bytes plus
normal | warning | critical severity for each disk. It covers the filesystem
backing the Captain base directory. Requires the server endpoint added in
caprover/caprover#2520.
caprover.getAppsRuntime() returns a CapRoverModels.AppsRuntimeResponse
containing runtime status, desired/running instance counts, current tasks, and
latest failure for each app. caprover.getAppRuntime(appName) returns
CapRoverModels.AppRuntimeDetails with the same fields plus up to ten historical
tasks, newest first. Unavailable runtime data has status: 'unavailable',
nullable counts, and an error message. These methods require the
server endpoints added in
caprover/caprover#2522.
npm installnpm run dev(after putting your own password/URL!)