Testing to Deployed a Node.js Back-End Notes App API in Google Cloud Platform with Google Compute Engine Virtual Machine (VM) Instances.
- Run
npm installto install all of the required dependencies. - Start the server in Production mode run
npm run startand to start in Development mode just simply runnpm run devthat's pretty much it.
Note: Make sure that
disablethe value of Block insecure private network inchrome://flagsto avoid Same-Origin Policy problems in browser. After that don't forget to set it back to thedefaultvalue.
Go to Google Cloud Console and create a firewall rule and VM instance.
- Create a firewall rule Navigation menu > VPC network > Firewall
| Properties | Values |
|---|---|
| Name | app-server-firewall |
| Paragraph | Allow Custom TCP Port 5000 |
| Targets | Specified target tags |
| Target tags | web-server |
| Source filter | IPv4 ranges |
| Source IPv4 ranges | 0.0.0.0/0 |
| Protocol and ports | Specified protocols and ports > check tcp > fill 5000 |
- Create a VM Instance Navigation menu > Compute Engine
| Properties | Values |
|---|---|
| Name | web-server |
| Region | asia-southeast2 (Jakarta) |
| Zone | asia-southeast2-a |
| Machine type | e2-micro (2 vCPU, 1 GB memory) |
| Boot disk | Type: New balanced persistent disk |
| Size: 10 GB | |
| Image: Ubuntu 20.04 LTS |
Test the Back-End System in here