Skip to content

2tocom/test2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo về bài làm này:

Chuẩn bị

File biến môi trường .env:
server:
  • 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).
public:
  • BACKEND_SERVER_URL=<server_address>/api/
  • PORT=<client_port> (5001)

Cài đặt nhanh

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

Các bước cài đặt cho linux

Bước 1: Cài đặt NodeJS và NPM sử dụng nvm

Đầu tiên, cần đăng nhập bằng tài khoản root hoặc user có quyền root

sudo su

Cài đặt node version manager (nvm).

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

Activate nvm.

. ~/.nvm/nvm.sh

Dùng nvm để cài đặt Nodejs

nvm install node

Kiểm tra đã có node và npm chưa:

node -v
npm -v

Bước 2: Cài PM2

  • PM2 giúp web app luôn chạy.
npm install pm2@latest -g && pm2 update

kiểm tra:

pm2 --version

Bước 3: Cài Git và clone repository từ GitHub

sudo apt-get update -y
sudo apt-get install git -y

Kiểm tra git đã được cài hay chưa:

git --version

clone project từ github:

git clone https://github.com/linux-vps/test2.git

chuyể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"

Một số tài liệu tham khảo:

  1. 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
  2. Ngrok: https://ngrok.com/download
  3. REST https://training.bitrix24.com/rest_help/
  4. Batch method: https://training.bitrix24.com/rest_help/general/batch.php

Postman ví dụ về việc sử dụng CRM REST API của Bitrix24.

Example in postman: - https://gist.github.com/gowizzard/3ae79b5fb3b4a73494e3c790c6d820c6

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published