https://docs.convex.dev/quickstart/
https://docs.convex.dev/quickstart/nodejs
how do i streamline data to my database with nodejs it looks here like they are just showing how to get data right?
9 Replies
If you need something else let us know more details: What is the problem you're trying to solve? Including relevant details.
just trying to insert data from my api into my convex db
Ah. The
client
from the Node.js quickstart has a mutation
method, which lets you call your mutations:
https://docs.convex.dev/functions/mutation-functionsMutations | Convex Developer Hub
Mutations insert, update and remove data from the database, check authentication
am I on the right track here using an action?
Not really. I recommend going through the tutorial to understand what is where. In this case it looks like you're putting the action definition (which belongs in your
convex/
folder and will be executed by your Convex backend) into your "client" code (in this case, a Node.js server).
https://docs.convex.dev/get-started
Your Node.js code should be using the ConvexHTTPClient to call actions/mutations/queries, and your Convex code should be separate and define the actions/mutations/queries.Welcome to Convex | Convex Developer Hub
Convex is a novel, fun, and extremely productive way to make backends for your
does it have to be in that convex folder though?
cause its using typescript and im using nodejs
why is it so complex why cant i just write to the db?
i dont see in the docs where it mentions nodejs
its all just react references
In the quickstart, there is a step for setting up a query, and then the query is called from Node.js.
Indeed in Convex you cannot "just write to the db", you have to define mutations that write to the DB. This lets you define what (and who) can and cannot write to the DB.
Most people don't use Node.js once they adopt Convex, although I can see that you're using custom websockets, so that might necessitate using Node.js - it depends on where those websocket messages are coming from.
If you have a website that talks to your Node.js server, you can probably replace Node.js entirely with Convex.