@owbase/node
v2.2.1
Published
Owbase SDK for Node.js (server, with an API key)
Readme
@owbase/node
SDK do Owbase para Node.js (servidor, com chave de API) · Owbase SDK for Node.js (server, with an API key)
Atende o servidor Owbase 2.7.2 (https://cloud.owbase.dev/v1). Node.js 18.17 ou mais novo.
Português
Instalação
npm install @owbase/nodeConfiguração
Crie uma chave de API no console do projeto, só com os escopos de que o backend precisa. A chave nunca vai para o navegador: no app web, use o @owbase/web.
import { Client } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1')
.setProject('<ID_DO_PROJETO>')
.setKey(process.env.OWBASE_API_KEY!);Banco, Storage e Auth
import { ID, Query, Storage, TablesDB, Users } from '@owbase/node';
import { InputFile } from '@owbase/node/file';
const db = new TablesDB(client);
const row = await db.createRow({ databaseId: '<ID_DO_BANCO>', tableId: 'pedidos', rowId: ID.unique(), data: { total: 120 } });
const { rows } = await db.listRows({ databaseId: '<ID_DO_BANCO>', tableId: 'pedidos', queries: [Query.greaterThan('total', 100)] });
const storage = new Storage(client);
const file = await storage.createFile({ bucketId: '<ID_DO_BUCKET>', fileId: ID.unique(), file: InputFile.fromPath('./nota.pdf', 'nota.pdf') });
const users = new Users(client);
const { total } = await users.list({ queries: [Query.limit(10)] });English
Install
npm install @owbase/nodeSetup
Create an API key in the project console with only the scopes your backend needs. Never ship the key to a browser: use @owbase/web there.
import { Client } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1')
.setProject('<PROJECT_ID>')
.setKey(process.env.OWBASE_API_KEY!);Database, Storage and Auth
import { ID, Storage, TablesDB, Users } from '@owbase/node';
import { InputFile } from '@owbase/node/file';
const row = await new TablesDB(client).createRow({ databaseId: '<DATABASE_ID>', tableId: 'orders', rowId: ID.unique(), data: { total: 120 } });
const file = await new Storage(client).createFile({ bucketId: '<BUCKET_ID>', fileId: ID.unique(), file: InputFile.fromPath('./invoice.pdf', 'invoice.pdf') });
const { users } = await new Users(client).list();Licença · License
BSD-3-Clause © Openwave. Avisos de terceiros em NOTICE · Third-party notices in NOTICE.
