0.7.1 • Published 4 years ago
@procdev/client v0.7.1
This is the official JavaScript client for Proc: Serverless web functions with superpowers.
Install
The easiest way to use the proc client from the browser is through the skypack cdn:
(async () => {
const Proc = await import("https://cdn.skypack.dev/@procdev/client");
const client = Proc.connect("{your-proc-authorization}");
...
})();
To use the proc client from node, install @procdev/client
using npm, then use it like this:
const Proc = require("@procdev/client");
const client = Proc.connect("{your-proc-authorization}");
...
Usage
Call procs just like local code:
client.type.number.add.call(1, {value: 1});
=> 2
Build more complex behaviors with compose
:
let time = client.time;
let composition = time.now.compose(
time.format(undefined, {string: "%A"})
);
composition.call();
=> "Tuesday"
Deploy custom endpoints instantly and call them from anywhere:
client.proc.create.call(undefined, {name: "day_of_week", proc: composition});
client.self.day_of_week.call();
=> "Tuesday"
Learn more at proc.dev. See you around!