Skip to content

signtomonika/MySql-GCP

Repository files navigation

REST API USING GOOGLE CLOUD MYSQL

This is Sample Application for using GCLOUD MySQL in NodeJS Application and deploying it to App Engine

Contents

Prerequisites

  • GCLOUD Instance Creation

  • Connect to the Server from MySQL Workbench or any MySQL Client

  • Run the scripts classicmodels.sql and classicmodelsTest.sql from client

  • Configure NodeJS Application to use GCLOUD MySQL

    • Create file config.json in the below format in "Root" folder

              {  
              "MYSQL_USER": "server user name",  
              "MYSQL_PASSWORD": "password",  
              "HOST_NAME": "ip address",  
              "DATABASE_NAME": "database name"  
              }   
      

Local Run 💻

 $npm start 

OR

$node server.js 

OR

$nodemon server.js

Open Link http://localhost:8080/

Testing 👍

$npm test

OR

$npm run test-watch

Open Link http://localhost:8080/

GCLOUD Deploy

  • Follow Steps to deploy the application
  • Create config.json file in the root folder with contents from local
  • run console gcloud app deploy