From c4810c194209d8bc7560e77c1f2eae61580473fa Mon Sep 17 00:00:00 2001 From: Brandon Rodriguez <brodriguez8774@gmail.com> Date: Fri, 31 Jul 2020 16:06:39 -0400 Subject: [PATCH] Create basic program to read and print out config --- app.js | 5 +++++ package.json | 10 ++++++++++ readme.md | 11 +++++++++++ 3 files changed, 26 insertions(+) create mode 100644 package.json diff --git a/app.js b/app.js index 8839896..8db8fd5 100644 --- a/app.js +++ b/app.js @@ -2,6 +2,9 @@ * NodeJS application to connect to MySQL and make database queries. */ +// User Imports. +import config from './src/config.js'; + /** * Program start. @@ -10,6 +13,8 @@ function main() { console.log('Starting program.'); console.log(''); + console.log(config['mysql']); + console.log(''); console.log('Terminating program.'); } diff --git a/package.json b/package.json new file mode 100644 index 0000000..8d3487b --- /dev/null +++ b/package.json @@ -0,0 +1,10 @@ +{ + "name": "mysql_bot_example", + "version": "1.0.0", + "description": "Test NodeJS application to connect to MySQL and make database queries.", + "main": "app.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "type": "module" +} diff --git a/readme.md b/readme.md index a177cf6..ef42fde 100755 --- a/readme.md +++ b/readme.md @@ -3,3 +3,14 @@ ## Description Example of using a NodeJS JavaScript application to connect to MySQL and make database queries. + + +## Program Setup +First, make sure MySQL is installed and setup on your program. Then install NodeJs. + +Once that's done, import `<project_root>/src/database_export.sql` to a new database, edit `<project_root>/src/config.js` +to connect to your local MySql instance. + + +## Running the Program +Once the program is setup, use a terminal to cd into project root, then run `node app.js`. -- GitLab