This is a starting point for connecting to a MySQL table using Node.js. Can be used for connecting from AWS' Lambda to MySQL RDS. Borrowed heavily from https://redstapler.co/aws-lambda-tutorial-rds-mysql/ . This is the starting point I use for new projects, shared in case it helps anyone else.
-
If you are new to Node/NPM, you will need to install Node on your machine using a Node version manager: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm#osx-or-linux-node-version-managers
-
Clone this repository
-
Enter your config settings in config/conn.json
-
Set a query to your database in index.js
-
Run "npm install"
-
Run "npm start" or "npm test" or "node index.js"
-
If using Lambda, make sure your function has execution roles for RDS