-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Adrian Preuß edited this page Jun 13, 2025
·
5 revisions
npm install --save datastorages
Import the Datastorages-API in your project:
import Database from 'datastorages';And set your Database-Type (optional: With their config):
Database.setType(<type>, <config>);Example for MySQL:
Database.setType(Database.MySQL);Or with configurations file:
/* With import */
import MyConfig from './config.json' with { type: 'json' };
Database.setConfig(MyConfig );
/* With file */
Database.setConfig('./config.json');
/* Set type without config, because it's already imported */
Database.setType(Database.MySQL);Or detailled:
Database.setType(Database.MySQL, {
Hostname: 'localhost',
Port: 3306,
Username: 'root',
password: '',
Database: 'test'
});