Node client for api.begin.com
Obtain an token
by creating a client at https://api.begin.com.
Install
npm i @begin/api
Usage
ESM
import { App } from '@begin/api'
CJS
const { App } = require('@begin/api')
App static methods
let { apps } = await App.list()
let app = await App.find({ access_token, appID })
let app = await App.create({ access_token, zip })
let app = await App.create({ access_token, chunk, zip })
App instance methods
let logs = await app.logs()
let logs = await app.builds()
await app.deploy({ zip })
await app.deploy({ chunk, zip })
await app.destroy()
Work with environment variables
let { env } = await app.env.get()
await app.env.set({ key: "HENLO", value: "world" })
await app.env.destroy({ key: "HENLO" })
Work with static assets
let { files } = await app.static.get()
let body = Buffer.from('console.log("hi")').toString('base64')
await app.static.set({ name: '/file.js', body })
await app.static.destroy({ name: '/file.js' })
Contributing
Create .env
with the following values:
BEGIN_CLIENT_ID=xxx
ACCESS_TOKEN=xxx