Docker集成OnlyOffice,并使用node服务访问

Worktile - onlyOffice模块使用

环境搭建

1.下载docker并安装(Docker官网有安装教程)

2.拉取onlyOffice镜像

sudo docker pull onlyoffice/documentserver

3.启动Docker容器 8080端口号

sudo docker run -i -t -d -p 8080:80 onlyoffice/documentserver

localhost:8080 访问后页面出现 Document Server is running 即启动成功

然后再从 你的github中 拉取onlyOffice的node中间服务

1.进入node中间项目 找到config下的default.json文件

2.修改default.json文件下的siteUrl

例如:siteUrl: http://192.133.73.127:8080 本机地址:docker服务的端口号

node中间服务下的bin文件有启动docker命令 可以直接./bin/run_docker.sh来启动docker服务

npm i

npm start

访问3000端口号 出现提示语 正确

拉取服务端项目,并切换至指定分支下

进入服务端项目 在server/config/index.js文件中添加

onlyOffice:{
host:‘http://192.133.73.127’,//本机ip地址
port:3000 //node中间服务的端口号
}

npm i

gulp ind 一键启动

==================================================================

在gaea服务下接口的使用

首先在 server/route/index.js 中的导出函数内添加全局路由配置

require("…/cdev/onlyoffice/middleLayer/index")(app,config);

再修改 onlyOffice/middleServer.js 中模块文件的导入路径

onlyoffice官方api文档:https://api.onlyoffice.com/

## 创建onlyOffice文件

http://worktile.local:8100/publicApi/onlyoffice/file/create?ext=1&parent_id=5a2e42abedf66b0036061ba9&belong=2&title=linux

method:post
parameters:
ext: 1 .docx文件 parent_id: 父文件夹的_id,如果是顶级文件夹则为空值 belong: 1 私有 title : 文件名称
2 pptx文件 2 公开
3 xlsx文件

## 浏览onlyOffice文件

http://worktile.local:8100/publicApi/onlyoffice/files/:id/editor

method: get
parameters:
id: 文件在数据库中的的_id

删除onlyOffice文件

http://localhost:8100/api/onlyoffice/files/:id

method:delete
parameters:
id: 文件在数据库中的的_id

下载onlyOffice文件

http://localhost:8100/api/onlyoffice/files/:id/download

method:get
parameters:
id: 文件在数据库中的的_id

上传onlyOffice文件

http://localhost:8100/api/onlyoffice/file/upload?belong=2&parent_id=

method:post
parameters: belong: 1 私有 parent_id: 父文件夹的_id,如果是顶级文件夹则为空值
2 公开

复制onlyOffice文件

http://localhost:8100/publicApi/onlyOffice/file/from/file

method:post
parameters belong: 1 私有 parent_id: 父文件夹的_id,如果是顶级文件夹则为空值
2 公开

猜你喜欢

转载自blog.csdn.net/qq_42427109/article/details/88665960