Skip to content

This repository will walk you through the process of quickly getting started with Sequelize, a promise-based Node.js object-relational mapping (ORM) library, to connect to and communicate with a MariaDB using the MariaDB Node.js connector.

License

Notifications You must be signed in to change notification settings

mariadb-developers/nodejs-sequelize-quickstart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Quick Start: Sequelize (Node.js) and MariaDB

This repository will walk you through the process of quickly getting started with Sequelize, a promise-based Node.js object-relational mapping (ORM) library, to connect to and communicate with a MariaDB using the MariaDB Node.js connector.

Requirements

Getting Started

1.) Clone this repo.

$ git clone https://github.com/mariadb-developers/nodejs-sequelize-quickstart.git

2.) Create the database schema and load test data using the schema.sql file.

You can do this by either copying, pasting and executing the SQL in schema.sql or with the MariaDB command-line client (from within the nodejs-sequelize-quickstart directory, which you just pulled down).

For example:

$ mariadb --host 127.0.0.1 --user root --pRootPassword123! < schema.sql

3.) Step in to the src directory and install the MariaDB Node.js driver (connector) using npm, Sequelize and dotenv (a zero-dependency module that loads environment variables from a .env file).

$ npm install mariadb sequelize

4.) Within src, create an environment file (e.g. $ touch .env) and add your database connection settings.

For example:

DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=root
DB_PASS=RootPassword123!
DB_NAME=demo

5.) Update the connection configuration to point to your database in the JavaScript sample files. For example, here.

6.) Execute the sample JavaScript files using the node CLI command.

For example:

$ node src/queries/customers_basic.js

$ node src/queries/customers_relationships.js

$ node src/queries/orders.js

...

The scripts:

Helpful Resources

Support and Contribution

Please feel free to submit PR's, issues or requests to this project directly.

If you have any other questions, comments, or looking for more information on MariaDB please check out:

Or reach out to us directly via:

License

License

About

This repository will walk you through the process of quickly getting started with Sequelize, a promise-based Node.js object-relational mapping (ORM) library, to connect to and communicate with a MariaDB using the MariaDB Node.js connector.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published