vovk-hello-world v0.0.69

A showcase app built with Next.js + Vovk.ts + Zod. For more details, visit https://vovk.dev/hello-world
License: MIT
# Install the package
npm install vovk-hello-world
UserRPC
UserRPC.updateUser
Update user
Update user by ID
POST https://hello-world.vovk.dev/api/users/{id}
import { UserRPC } from 'vovk-hello-world';
const response = await UserRPC.updateUser({
body: {
// -----
// User data object
// -----
// User email
email: "john@example.com",
// User profile object
profile: {
// User full name
name: "John Doe",
// User age
age: 25
}
},
query: {
// -----
// Query parameters
// -----
// Notification type
notify: "email"
},
params: {
// -----
// Path parameters
// -----
// User ID
id: "123e4567-e89b-12d3-a456-426614174000"
},
});
console.log(response);
/*
{
// -----
// Response object
// -----
// Success status
success: true,
// User ID
id: "00000000-0000-0000-0000-000000000000",
// Notification type
notify: "email"
}
*/
StreamRPC
StreamRPC.streamTokens
Stream tokens
Stream tokens to the client
GET https://hello-world.vovk.dev/api/streams/tokens
import { StreamRPC } from 'vovk-hello-world';
using response = await StreamRPC.streamTokens();
for await (const item of response) {
console.log(item);
/*
{
// -----
// Streamed token object
// -----
// Message from the token
message: "string"
}
*/
}
OpenApiRPC
OpenApiRPC.getSpec
OpenAPI spec
Get the OpenAPI spec for the “Hello World” app API
GET https://hello-world.vovk.dev/api/static/openapi.json
import { OpenApiRPC } from 'vovk-hello-world';
const response = await OpenApiRPC.getSpec();