{"id":21046599,"url":"https://github.com/linux-vps/test2","last_synced_at":"2025-03-13T22:24:03.744Z","repository":{"id":255019958,"uuid":"848289388","full_name":"linux-vps/test2","owner":"linux-vps","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-29T19:03:54.000Z","size":14865,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-20T17:49:56.179Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/linux-vps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-27T13:45:22.000Z","updated_at":"2024-08-29T19:03:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"0adfd4d4-999b-48f4-b688-caac9cbc7390","html_url":"https://github.com/linux-vps/test2","commit_stats":null,"previous_names":["linux-vps/test2"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-vps%2Ftest2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-vps%2Ftest2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-vps%2Ftest2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-vps%2Ftest2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linux-vps","download_url":"https://codeload.github.com/linux-vps/test2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243490832,"owners_count":20299205,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T14:30:59.995Z","updated_at":"2025-03-13T22:24:03.723Z","avatar_url":"https://github.com/linux-vps.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Demo về bài làm này:\n- Web app với ngrok tunel: ( Nếu trang không có dữ liệu trong bảng, vui lòng refresh lại ạ )\n  - https://d028-47-84-81-252.ngrok-free.app/\n\n\n## Chuẩn bị\n##### Bitrix24 OAuth 2.0: https://api.postman.com/collections/34247664-f81670c2-998b-4f5c-abcb-e9ec6aca61a3?access_key=PMAT-01J6AEPZ7CZG6K36PCYK5EGGP2\n##### File biến môi trường .env:\n###### server:\n  - CLIENT_URL=\u003chttps://domain/path\u003e (frontend url))\n  - APP_ID=\u003capplication_id\u003e (Application ID (client_id), e.g.: local.xxxxxxxxxx )\n  - APP_SECRET=\u003cclient_secret\u003e (Application key (client_secret))\n  - BITRIX24_DOMAIN=\u003csubdomain\u003e.bitrix24.vn\n  - PORT=\u003cserver_port\u003e ( 5000).\n\n###### public:\n  - BACKEND_SERVER_URL=\u003cserver_address\u003e/api/ \n  - PORT=\u003cclient_port\u003e (5001)\n## Cài đặt nhanh\nLệnh bên dưới hỗ trợ cài môi trường, dự án và các thư viện liên quan:\n```\nbash \u003c(curl -Ls https://raw.githubusercontent.com/linux-vps/test2/main/install.sh)\n```\nĐể deploy, chạy lệnh dưới đây trong thư mục dự án:\n```bash\n./deploy.sh\n```\n\n## Các bước cài đặt cho linux\n\n### Bước 1: Cài đặt NodeJS và NPM sử dụng nvm\n\nĐầu tiên, cần đăng nhập bằng tài khoản root hoặc user có quyền root\n\n```bash\nsudo su\n```\n\nCài đặt node version manager (nvm).\n\n```bash\ncurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash\n```\nActivate nvm.\n\n```bash\n. ~/.nvm/nvm.sh\n```\n\nDùng nvm để cài đặt Nodejs\n```bash\nnvm install node\n```\n\nKiểm tra đã có node và npm chưa:\n\n```bash\nnode -v\nnpm -v\n```\n\n### Bước 2: Cài PM2\n- PM2 giúp web app luôn chạy.\n```bash\nnpm install pm2@latest -g \u0026\u0026 pm2 update\n```\nkiểm tra:\n ```bash\n pm2 --version\n ```\n\n### Bước 3: Cài Git và clone repository từ GitHub\n\n```bash\nsudo apt-get update -y\nsudo apt-get install git -y\n```\n\nKiểm tra git đã được cài hay chưa:\n\n```bash\ngit --version\n```\n\nclone project từ github:\n\n```bash\ngit clone https://github.com/linux-vps/test2.git\n```\n\nchuyển vào thư mục test2\n```bash\ncd test2\n```\n\n\nĐổi tên file \".env.example\" thành \".env\"\n\n ```bash\n cd public\n mv .env.example .env\n cd ..\n cd server\n mv .env.example .env\n cd ..\n \n ```\nChạy web app\n\nNavigate vào thư mục server:\n```bash\ncd server\nnpm install\npm2 start index.js --watch --ignore-watch \"node_modules,config\" --name \"server\"\n```\nNavigate vào thư mục public:\nCó 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.\nCòn thư mục public này cài hơi lâu.\n```bash\ncd public\nnpm install\nnpm run build\npm2 start index.js --watch --ignore-watch \"node_modules,config\" --name \"public\"\n```\n### Một số tài liệu tham khảo:\n 1. OAuth 2.0 Protocol:\n    https://training.bitrix24.com/support/training/course/?COURSE_ID=169\u0026LESSON_ID=20110\n    https://training.bitrix24.com/rest_help/oauth/index.php\n 3. Ngrok:\n    https://ngrok.com/download\n 4. REST\n    https://training.bitrix24.com/rest_help/\n 5. Batch method:\n    https://training.bitrix24.com/rest_help/general/batch.php\n### Postman ví dụ về việc sử dụng CRM REST API của Bitrix24.\n***Example in postman***:\n    - https://gist.github.com/gowizzard/3ae79b5fb3b4a73494e3c790c6d820c6\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinux-vps%2Ftest2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinux-vps%2Ftest2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinux-vps%2Ftest2/lists"}