Reference
Resource API Reference
Authoritative API reference for defineApp(), api, storage(), and queue() primitives from the novaserve package.
defineApp(options)
Initializes the NovaServe application container.
Signature
function defineApp(options: AppOptions): AppDefinition;| Parameter | Type | Description |
|---|---|---|
| name | string | Unique application identifier for cloud resource naming |
| region | string (optional) | Default cloud region (e.g., us-east-1) |
| version | string (optional) | Semantic version tag for deployment artifacts |
Example
import { defineApp } from "novaserve";
export const app = defineApp({ name: "billing-service", region: "us-east-1" });api.get() / api.post() / api.put() / api.delete()
Registers HTTP endpoints with automatic IAM scoping.
Signatures
api.get(path: string, handler: (req: Request) => Promise<any>): RouteRef;
api.post(path: string, handler: (req: Request) => Promise<any>): RouteRef;
api.put(path: string, handler: (req: Request) => Promise<any>): RouteRef;
api.delete(path: string, handler: (req: Request) => Promise<any>): RouteRef;Example
import { api } from "novaserve";
export const getItems = api.get("/items/:id", async (req) => {
return { id: "123", name: "Cloud Server" };
});
export const createItem = api.post("/items", async (req) => {
const body = await req.json();
return { id: "new_123", ...body };
});storage(name, options)
Declares an object storage bucket (Amazon S3 / Cloudflare R2).
Signature
function storage(name: string, options?: StorageOptions): StorageBucket;Instance Methods
| Method | Inferred IAM |
|---|---|
| put(key, data) | s3:PutObject |
| get(key) | s3:GetObject |
| delete(key) | s3:DeleteObject |
Example
import { storage } from "novaserve";
export const avatars = storage("user-avatars", { public: true });
await avatars.put("avatar.png", imageBuffer);queue(name, options)
Declares a message queue (Amazon SQS / Cloudflare Queues).
Signature
function queue(name: string, options?: QueueOptions): MessageQueue;Instance Methods
| Method | Inferred IAM |
|---|---|
| push(message) | sqs:SendMessage |
| process(handler) | sqs:ReceiveMessage, sqs:DeleteMessage |
Example
import { queue } from "novaserve";
export const emailQueue = queue("send-emails");
await emailQueue.push({ to: "dev@example.com", subject: "Welcome!" });