From ffc298276d6f2b168d9727051f16218722efbb75 Mon Sep 17 00:00:00 2001 From: Yuinyan20 <6dinformaticasinfante@gmail.com> Date: Thu, 19 Sep 2024 01:16:50 -0400 Subject: [PATCH] Expanded ReadMe to include more detailed information --- README.md | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 563b2a35..5ea6453b 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,26 @@ Quick.db is an open-source package meant to provide an easy way for beginners an [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/zelak) -## Installation +## Prerequisites +Before you get started, ensure you have the following installed: +- **Node.js** (Version 12 or higher): [Download here](https://nodejs.org/) +- **NPM**: Comes pre-installed with Node.js + +You can check if Node.js and NPM are installed by running the following commands in your terminal: +```bash +node -v +npm -v +``` +## Installation +To install Quick.db and its dependencies, run the following command in your Node.js project: ```bash -npm i quick.db +npm install quick.db ``` +By default, Quick.db uses SQLite for storage, so no additional configuration is required for basic setups. + +
Mac Prerequisites @@ -41,6 +55,47 @@ npm i quick.db > If you're having troubles installing, please follow [this troubleshooting guide](https://github.com/JoshuaWise/better-sqlite3/blob/master/docs/troubleshooting.md). > Windows users may need to do additional steps listed [here](https://github.com/JoshuaWise/better-sqlite3/blob/master/docs/troubleshooting.md). +## Multiple Database Drivers + +Quick.db supports various database drivers. By default, it uses SQLite, but you can also configure it to use MySQL, PostgreSQL, or Mongoose. + +**Driver Setup**: +To switch to a different database driver, follow these steps: + +1. **For MySQL**: + Install MySQL driver: + ```bash + npm install mysql2 + ``` + Modify your code to use MySQL: + ```javascript + const { QuickDB } = require("quick.db"); + const db = new QuickDB({ driver: "mysql", user: "root", password: "", database: "quickdb" }); + ``` + +2. **For PostgreSQL**: + Install PostgreSQL driver: + ```bash + npm install pg + ``` + Modify your code to use PostgreSQL: + ```javascript + const { QuickDB } = require("quick.db"); + const db = new QuickDB({ driver: "pg", user: "postgres", password: "", database: "quickdb" }); + ``` + +3. **For Mongoose**: + Install Mongoose driver: + ```bash + npm install mongoose + ``` + Modify your code to use Mongoose: + ```javascript + const mongoose = require('mongoose'); + mongoose.connect('mongodb://localhost/quickdb', { useNewUrlParser: true, useUnifiedTopology: true }); + const db = require('quick.db'); + ``` + ## Example With Sqlite (Default driver) > **NOTE:** In order to use this driver, install `npm i better-sqlite3` separately.