- Web app với ngrok tunel: ( Nếu trang không có dữ liệu trong bảng, vui lòng refresh lại ạ )
Bitrix24 OAuth 2.0: https://api.postman.com/collections/34247664-f81670c2-998b-4f5c-abcb-e9ec6aca61a3?access_key=PMAT-01J6AEPZ7CZG6K36PCYK5EGGP2
- CLIENT_URL=https://domain/path (frontend url))
- APP_ID=<application_id> (Application ID (client_id), e.g.: local.xxxxxxxxxx )
- APP_SECRET=<client_secret> (Application key (client_secret))
- BITRIX24_DOMAIN=.bitrix24.vn
- PORT=<server_port> ( 5000).
- BACKEND_SERVER_URL=<server_address>/api/
- PORT=<client_port> (5001)
Lệnh bên dưới hỗ trợ cài môi trường, dự án và các thư viện liên quan:
bash <(curl -Ls https://raw.githubusercontent.com/linux-vps/test2/main/install.sh)
Để deploy, chạy lệnh dưới đây trong thư mục dự án:
./deploy.shĐầu tiên, cần đăng nhập bằng tài khoản root hoặc user có quyền root
sudo suCài đặt node version manager (nvm).
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bashActivate nvm.
. ~/.nvm/nvm.shDùng nvm để cài đặt Nodejs
nvm install nodeKiểm tra đã có node và npm chưa:
node -v
npm -v- PM2 giúp web app luôn chạy.
npm install pm2@latest -g && pm2 updatekiểm tra:
pm2 --versionsudo apt-get update -y
sudo apt-get install git -yKiểm tra git đã được cài hay chưa:
git --versionclone project từ github:
git clone https://github.com/linux-vps/test2.gitchuyển vào thư mục test2
cd test2Đổi tên file ".env.example" thành ".env"
cd public
mv .env.example .env
cd ..
cd server
mv .env.example .env
cd ..
Chạy web app
Navigate vào thư mục server:
cd server
npm install
pm2 start index.js --watch --ignore-watch "node_modules,config" --name "server"Navigate vào thư mục public: Có thể do web app xây dựng trên window nên khi cài thư viện trên linux mất thời gian. Còn thư mục public này cài hơi lâu.
cd public
npm install
npm run build
pm2 start index.js --watch --ignore-watch "node_modules,config" --name "public"- OAuth 2.0 Protocol: https://training.bitrix24.com/support/training/course/?COURSE_ID=169&LESSON_ID=20110 https://training.bitrix24.com/rest_help/oauth/index.php
- Ngrok: https://ngrok.com/download
- REST https://training.bitrix24.com/rest_help/
- Batch method: https://training.bitrix24.com/rest_help/general/batch.php
Example in postman: - https://gist.github.com/gowizzard/3ae79b5fb3b4a73494e3c790c6d820c6