This example will help you integrate ONLYOFFICE Docs into your web application on Node.js.
Please keep in mind the following security aspects when you are using test examples:
Download and install ONLYOFFICE Docs (packaged as Document Server):
See the detailed guide to learn how to install ONLYOFFICE Docs for Windows.
Download the Node.js example from our site.
To connect the editors to your website, specify the path to the editors installation and the path to the storage folder in the config/default.json file:
"storageFolder": "./files" "storagePath": "/files" "siteUrl": "https://documentserver/"
where the documentserver is the name of the server with the ONLYOFFICE Docs installed, the storageFolder and storagePath are the paths where files will be created and stored. You can set an absolute path. For example, D:\\folder. Please note that on Windows OS the double backslash must be used as a separator.
If you want to experiment with the editor configuration, modify the parameters in the \views\editor.ejs file.
Install the node.js environment which is going to be used to run the Node.js project. Please follow the link at the official website choosing the correct version for your Windows OS (32-bit or 64-bit).
We will run the code in Node.js runtime environment and will interact with it using the command line interface (cmd).
A new node_modules folder will be created in the project folder.
In case the example and ONLYOFFICE Docs are installed on different computers, make sure that your server with the example installed has access to the ONLYOFFICE Docs with the address which you specify instead of documentserver in the configuration files. Make sure that the ONLYOFFICE Docs in its turn has access to the server with the example installed with the address which you specify instead of example.com in the configuration files.
If you integrated the editors successfully the result should look like the demo preview on our site.
Download and install ONLYOFFICE Docs (packaged as Document Server):
See the detailed guide to learn how to install ONLYOFFICE Docs for Linux.
Edit the following lines:
"storageFolder": "./files" "storagePath": "/files" "siteUrl": "https://documentserver/"
where the documentserver is the name of the server with the ONLYOFFICE Docs installed, the storageFolder and storagePath are the paths where files will be created and stored. Please note that you must have read and write permissions to the folder. If you do not have them, please use the next command:
sudo chmod -R ugo+rw /{path}
In case the example and ONLYOFFICE Docs are installed on different computers, make sure that your server with the example installed has access to the ONLYOFFICE Docs with the address which you specify instead of documentserver in the configuration files. Make sure that the ONLYOFFICE Docs in its turn has access to the server with the example installed with the address which you specify instead of example.com in the configuration files.
If you integrated the editors successfully the result should look like the demo preview on our site.