⚡Overview
crud-node is an agnostic database client for Nodejs that allows you to perform CRUD operations to a database in a simple way.
Motivation
Out of the box, database clients such as pg, mysql, knex, and more do not come with an opinionated way of querying or mutating data from your database so developers end up building their own ways of performing CRUD operations.
This usually means that most of the time developer has to build himself the logic for querying a database and also make the implementation reusable across the entire system.
Crud Node is hands down one of the best packages for managing CRUD operations to a database. It works amazingly well out-of-the-box, with zero-config, and can be extended to your liking as your application grows.
Crud Node allows you to defeat and overcome the tricky challenges and hurdles of querying a database and controlling your app data before it starts to control you.
Enough talk, show me some code!
Config
// config.{ts|js}
import { MySQL } from 'crud-node';
// Connection configuration object
export const connection = {
host: 'localhost',
port: 3306,
schema: 'db',
password: 'user',
user: 'user',
timezone: '+00:00',
};
export const settings = {
ciCollation: 'utf8mb4_0900_ai_ci',
};
export const db = new MySQL(connection, settings);
await db.connect();Schema
Controller (!optional)
Create record
Config
Schema
Controller (!optional)
Create record
Congratulations! You successfully created a record in the database.
Last updated