Using the noonjs Client is totally optional. Feel free to interact with the backend the old-school way via REST & Socket.IO.
The noonjs Client is a TypeScript-based library designed to seamlessly interact with the noonjs backend. It eliminates the need for manual API calls by automatically generating request methods based on the defined schemas in config.json.
To install the noonjs Client, use npm, yarn, or pnpm:
import Client from "noonjs-client";
const client = new Client({ server: "https://localhost:5000" }); // my-noon-server
Server property is optional
{
"collections": {
"todos": {
"schema": {
"title": {
"type": "string"
},
"done": {
"type": "number"
}
},
"permissions": {
"*": true
}
}
}
}
To add a new todo item to the 'todos' collection using the noonjs client, use the following command. This example adds a todo with the title 'Buy milk'.const todo = await client.collection("todos").post({ title: "Buy milk" });
To fetch all todo items from the 'todos' collection using the noonjs client, use the following command. Need more details on pagination?const todos = await client.collection("todos").get();
Building something epic here. Sorry for the dust, we’ll clean up when we’re done!
Client under construction: We’ve got builders, architects, and a few squirrels working on this!
Warning: This client is under construction. Proceed with caution. Magic is happening!