@nbn23/cloud-tasks
v1.3.3
Published
Cloud tasks library
Downloads
376
Readme
NBN23 CloudTasks
CloudTasks is a wrapper over a cloud task library to avoid vendor lock and provide an utility to schedule HTTP requests as tasks.
The current version works over @google-cloud/tasks
library in Google Cloud Platorm.
Getting Started
Install CloudTasks using npm.
npm install --save @nbn23/cloud-tasks
Note: CloudTasks assumes a TypeScript environment
Usage
import { CloudTasks } from "@nbn23/cloud-tasks";
const projectId = "string";
const location = "españa-west-1";
const cloudTasks = await CloudTasks.newInstance({ projectId, location });
const task = {
url: "https://fake.com",
method: Method.POST,
headers: { "Content-Type": "application/json" },
body: { foo: "bar" }
};
const queue = "name-queue";
await cloudTasks.schedule(queue, task);