Git Product home page Git Product logo

mariadb-developers / nodejs-sequelize-quickstart Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 3.0 8 KB

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: MIT License

JavaScript 100.00%
mariadb mariadb-database mariadb-nodejs nodejs nodejs-database nodejs-sequelize javascript javascript-nodejs javascript-database javascript-sequelize

nodejs-sequelize-quickstart's Introduction

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

nodejs-sequelize-quickstart's People

Contributors

rhedgpeth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.