https://github.com/nricciardi/dbapirest-node
Javascript class for NodeJS that allows you to interface with a MySQL database using the CRUD model
https://github.com/nricciardi/dbapirest-node
Last synced: 3 months ago
JSON representation
Javascript class for NodeJS that allows you to interface with a MySQL database using the CRUD model
- Host: GitHub
- URL: https://github.com/nricciardi/dbapirest-node
- Owner: nricciardi
- Created: 2021-07-28T14:34:21.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-07-29T17:42:09.000Z (almost 4 years ago)
- Last Synced: 2025-01-12T23:31:05.454Z (5 months ago)
- Language: JavaScript
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DBApiRest
Javascript class for NodeJS that allows you to interface with a MySQL database using the CRUD model# What to install?
- mysql (npm i mysql)# How to initialize?
const HOST = "127.0.0.1";
const USER = "root";
const PASSWORD = "";
const DATABASE = "dbName";const DBApiRest = new (require('./DBApiRest')).DBApiRest(HOST, USER, PASSWORD, DATABASE); // you can add table name after DATABASE
# Set table
await DBApiRest.use("tableName");# CRUD:
# Create
await DBApiRest.create({...}); // in {} insert fields# Read
await DBApiRest.read(); // you can read a particular record using .read(id)# Update
await DBApiRest.update({...}); // in {} insert fields# Delete
await DBApiRest.delete(id); // you can delete more than one record using .delete([id1, id2, ...])