Kết nối cơ sở dữ liệu đơn giản

Triển khai simple code

  1. Để clone code từ GitHub, bạn có thể sử dụng lệnh sau:
git clone https://github.com/hiepnguyendt/sample-database-connection.git

simplecode

  1. Chỉnh sửa file .env với thông tin xác thực cơ sở dữ liệu của bạn
nano .env

simplecode

  • DB_USER: ‘your username’
  • DB_PASS: ‘your password’
  • DB_HOST: ’endpoint your RDS PostgreSQL'
  • DB_PORT: ‘5432’

simplecode

  1. Chạy code:
npm start

simplecode

Bây giờ, bạn đang kết nối với RDS PostgreSQL với:

  • User: masteruser
  • Database: pglab
  • Port: 5432