Skip to content

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Repository files navigation

https://github.com/caprover/caprover-api

Official CapRover API SDK (TypeScript)

A simple, typed Typescript SDK for the CapRover API.

EXPERIMENTAL - backward compatibility is not guaranteed.

Install

npm install caprover-api

Usage

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.

How to Run Locally

  1. npm install
  2. npm run dev (after putting your own password/URL!)

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages