- 連接 mysql
- 建立 express 連線
- 建立 API 查詢姓名取得資訊
- 判斷是否有原告或被告姓名
- 若有回傳資訊,沒有回傳 404
- 原告姓名
- 被告姓名
- 租金
- 地區
- 勝訴方
- 案件 ID
- 年份
- 安裝指令
https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.22-1_all.deb
sudo apt update
sudo apt-cache policy mysql-server
sudo apt install mysql-client mysql-server
- 設定密碼
- mysql
- rental
- judicialFileset
- id
string
- plaintiff
string
- defendant
string
- city
string
- win
enum
- plaintiff
- defendant
- rent
int
- jyear
string
- id
- judicialFileset
- rental
- sudo service mysql start
- npm i -g pm2 typescript
- cd rental-housing/api-judicial-cases
- tsc
- pm2 start rental-housing/api-judicial-cases/ecosystem.config.js
- 查詢姓名是否有在預警名單
sudo vim /etc/nginx/sites-enabled/api.rental.imallenlai.com
server {
listen 80;
server_name api.rental.imallenlai.com;
location / {
proxy_pass http://127.0.0.1:3010;
}
}
- 在 AWS Route 53 新增 A 紀錄指到主機 IP
- 在 nginx 的設定檔新增 domain 的 nginx 設定檔
/etc/nginx/sites-enabled/api.rental.imallenlai.com
server {
server_name api.rental.imallenlai.com;
location / {
proxy_pass http://127.0.0.1:3010;
}
}
- 利用 certbot 建立 SSL 憑證,並且選擇 http 自動轉址
sudo certbot --nginx -d example.com
- 確認 nginx 設定檔是否正確
sudo nginx -t
- 確認 nginx 設定檔是否正確
sudo nginx -s reload
- 本地上傳到遠端
scp -i ./pem -r build/* ec2@remote:/build
FIREBASE_API_KEY= FIREBASE_AUTH_DOMAIN= FIREBASE_PROJECT_ID= FIREBASE_STORAGE_BUCKET= FIREBASE_MESSAGING_SENDER_ID= FIREBASE_APP_ID= MEASUREMENT_ID= SESSION_SECRET=