Socket
Socket
Sign inDemoInstall

@convex-dev/server

Package Overview
Dependencies
31
Maintainers
7
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @convex-dev/server


Version published
Maintainers
7
Created

Readme

Source

@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> => {
  // Your (read-only) code here!
});

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> => {
  // Your mutation code here!
});

See the Convex Getting Started guide for more details on how to get started.

See also

  • @convex-dev/browser is the library used by client-side code running in the browser to interact with Convex server-side functions.
  • @convex-dev/react is a layer on top of @convex-dev/browser that provides React hooks for data binding to Convex functions.
  • @convex-dev/cli is the CLI tool for spinning up Convex backends and syncing functions.

Keywords

FAQs

Last updated on 31 Mar 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc