Database
We use enmap to connect to your mongo database as it is fast and easy to use. Because of deprecation we use enmap 3 and enmap-mongo.
All commands can be found here: https://enmap.evie.dev/v/3/
You can access the database through the module (1) or on startup in the constructor (2)
1
// 1
2
const database = require("js-spring").database;
3
4
// 2
5
const { database } new SpringJS({ name: "test" });
Copied!
We recommend for multiple files by starting up in a main file and accessing the database using the first method

Example usage

1
const SpringJS = require("js-spring");
2
const { database } new SpringJS({ name: "test" });
3
4
database.set("DanCodes", "Spring.js");
5
6
console.log("DanCodes wrote " + database.get("DanCodes") + "!");
Copied!
Last modified 2yr ago
Copy link