saveData
Save data in the database
const schema = {
name: String,
lastname: String,
age: Number,
};
const props = {
name: 'example', // Schema Name
schema: schema // Schema Object
};
module.exports = props;const { LocalServer, getLocalServer, saveData } = require('naturesaving');
const ExampleSchema = require('path-to-schema') // The path to your schema
const server = new LocalServer({ name: 'Example', path: './database' });
const localServer = getLocalServer({ name: 'Example' });
const data = {
name: 'Max',
lastname: 'Mustermann',
age: 50
};
saveData({ server: localServer, schema: ExampleSchema, data: data }); // Save the dataLast updated