Skip to content

rainercedric23/Docker-NodeJS-MySQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Docker-NodeJS-MySQL

Docker created with the stack of nodejs and mysql

Sample Nodejs connection to MySQL server using mysql2 library

import mysql from "mysql2";
import config from "./config";

// create the connection to database
const connection = mysql.createPool({
    host: config.MYSQL_HOST,
    user: config.MYSQL_USER,
    database: config.MYSQL_DATABASE,
    password : config.MYSQL_PASSWORD,
    port: config.MYSQL_PORT,
    waitForConnections: true,
    connectionLimit: 10,
    queueLimit: 0,
});

export default connection;

Rename .env.example to .env and change path directory ENV_APP_DIR_HOST

And you're all set you are ready to run your nodejs application!

About

Docker created with the stack of nodejs and mysql

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published