@convex-dev/server
Server library for Convex functions to interact with data in the Convex Cloud.
Usage
Convex functions are defined by using either the query
or mutation
functions.
Queries receive a db
that implements the
DatabaseReader
interface.
import { query } from "@convex-dev/server";
export default query(async ({ db }, ...args: any[]): Promise<any> => {
});
If your function needs to write to the database, such as inserting, updating, or
deleting documents, use mutation
instead which provides a db
that implements
the
DatabaseWriter
interface.
import { mutation } from "@convex-dev/server";
export default mutation(async ({ db }, ...args: any[]): Promise<any> => {
});
See
the Convex Getting Started guide
for more details on how to get started.
See also