Getting Started
CORMO is an ORM framework for Node.js.
Currently supports:
- multi-DB: MySQL, MongoDB, SQLite3, PostgreSQL
- constraints
- validations
- associations
- geospatial query
- callbacks
- aggregation
- nested column
- transactions
- schema migration
Installation
You should install the CORMO module and drivers for databases you want. (mysql2 or mysql for MySQL. mongodb for MongoDB. sqlite3 for SQLite3. pg for PostgreSQL.)
$ npm install cormo mysql2
Setup
Define a connection and models like this:
import * as cormo from 'cormo';
const connection = new cormo.MySQLConnection({ database: 'test' });
@cormo.Model()
class User extends cormo.BaseModel {
@cormo.Column({ type: String })
name?: string;
@cormo.Column({ type: cormo.types.Integer })
age?: number;
}