Spring.js
  • Welcome
  • Startup
  • Express
  • Database
  • Examples
  • Command Line
Powered by GitBook
On this page

Was this helpful?

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.

PreviousExpressNextExamples

Last updated 5 years ago

Was this helpful?

All commands can be found here:

You can access the database through the module (1) or on startup in the constructor (2)

// 1
const database = require("js-spring").database;

// 2
const { database } new SpringJS({ name: "test" });

We recommend for multiple files by starting up in a main file and accessing the database using the first method

Example usage

const SpringJS = require("js-spring");
const { database } new SpringJS({ name: "test" });

database.set("DanCodes", "Spring.js");

console.log("DanCodes wrote " + database.get("DanCodes") + "!");
https://enmap.evie.dev/v/3/