NodeJS
Windows
For a CADViewer NodeJS installation on Windows, the base file-structure should be as below:
c:/nodejs └─── cadviewer ├── app │ ├── cv │ │ ├── cv-pro │ │ │ ├── menu_config │ │ │ ├── language_table │ │ │ └── space │ │ │ ├── css │ │ │ └── html │ │ ├── cv-core │ │ │ ├── menu_config │ │ │ └── language_table │ │ └── cv-custom_commands │ ├── fonts │ ├── images │ ├── js │ ├── css │ └── user_resources ├── converters │ ├── ax2020 │ │ ├── windows │ │ │ └── fonts │ │ └── linux │ │ └── fonts │ ├── dwgmerge2020 │ │ ├── windows │ │ │ └── fonts │ │ └── linux │ │ └── fonts │ ├── linklist2020 │ │ ├── windows │ │ │ └── fonts │ │ └── linux │ │ └── fonts │ └── files ├── content ├── html └── temp_print
Note that folders for advanced interaction, such as database connectivity and advanced REST-API connectivity features are not included in this folder tree, please see the Samples section for integration with this type of functionality.
Windows - Configuration
In folder:
c:/nodejs └─── cadviewer
locate the configuration file: CADViewer_config.json , edit the settings to reflect your installation. Note that, in this setup is assuming the front-end server with the CADViewer html file to have the ServerFrontEndUrl and the conversion server to have the ServerUrl settings.
In folder:
c:/nodejs └─── cadviewer └── html
identify your sample mysample.html file, and ensure that it loads the CADViewer_NodeJSHandlerSettings.js file:
In folder:
c:/nodejs └─── cadviewer └── app └── cv
Open the CADViewer_NodeJSHandlerSettings.js file, and ensure that the top variable settings correspond to your server settings :
Run the Back-End server from the location of the installation, C:\nodejs\cadviewer:
C:\nodejs\cadviewer>node CVserver-v6_1_0.js
http://127.0.0.1:3000
http://127.0.0.1:8081
getFile_09
true
CADViewer Server is listening on port 3000!
Server running at http://127.0.1.1:3000/
Run the server serving the Front-End from the location of the installation, C:\nodejs\cadviewer:
C:\nodejs\cadviewer>npx http-server
npx: installed 26 in 4.196s
Starting up http-server, serving ./
Available on:
http://192.168.1.135:8081
http://178.30.104.178:8081
http://127.0.0.1:8081
Hit CTRL-C to stop the server
Alternatively, if npx is not installed, use npm to install a http server globally, and then run the Front-End server specifically on port 8081, from the location of the installation C:\nodejs\cadviewer:
C:\nodejs\cadviewer>npm install http-server -g
C:\nodejs\cadviewer>http-server -p 8081
Starting up http-server, serving ./
Available on:
http://79.102.163.72:8081
http://127.0.0.1:8081
Hit CTRL-C to stop the server
Open a web-browser pointing to your sample html file: http:/127.0.0.1/8081/html/mysample.html
Use the server traces and browser development console for debugging, alternatively contact our Support
Linux
On Linux a NodeJS server can be launched from any location, a CADViewer NodeJS installation on Linux, the suggested base file-structure under user structure should be as below:
/usr/bin └─── cadviewer ├── app │ ├── cv │ │ ├── cv-pro │ │ │ ├── menu_config │ │ │ ├── language_table │ │ │ └── space │ │ │ ├── css │ │ │ └── html │ │ ├── cv-core │ │ │ ├── menu_config │ │ │ └── language_table │ │ └── cv-custom_commands │ ├── fonts │ ├── images │ ├── js │ ├── css │ └── user_resources ├── converters │ ├── ax2020 │ │ ├── windows │ │ │ └── fonts │ │ └── linux │ │ └── fonts │ ├── dwgmerge2020 │ │ ├── windows │ │ │ └── fonts │ │ └── linux │ │ └── fonts │ ├── linklist2020 │ │ ├── windows │ │ │ └── fonts │ │ └── linux │ │ └── fonts │ └── files ├── content ├── html └── temp_print
Note that folders for advanced interaction, such as database connectivity and advanced REST-API connectivity features are not included in this folder tree, please see the Samples section for integration with this type of functionality.
Linux - Configuration
In folder:
/usr/bin └─── cadviewer
locate the configuration file: CADViewer_config.json , edit the settings to reflect your installation. Note that, in this setup is assuming the front-end server with the CADViewer html file to have the ServerFrontEndUrl and the conversion server to have the ServerUrl settings.
In folder:
/usr/bin └─── cadviewer └── html
identify your sample mysample.html file, and ensure that it loads the CADViewer_NodeJSHandlerSettings.js file:
In folder:
/usr/bin └─── cadviewer └── converters └── ax2020 └── linux
Ensure that the executable has chmod 777 permissions.
In folder:
/usr/bin └─── cadviewer └── app └── cv
Open the CADViewer_NodeJSHandlerSettings.js file, and ensure that the top variable settings correspond to your server settings :
Run the Back-End server from the location of the installation, /usr/bin/cadviewer:
user@user-VirtualBox:~$ pwd
/usr/bin/cadviewer
user@user-VirtualBox:~$ node CVserver-v6_1_0.js
http://127.0.0.1:3000
http://127.0.0.1:8081
getFile_09
true
CADViewer Server is listening on port 3000!
Server running at http://127.0.1.1:3000/
Run the server serving the Front-End from the location of the cadviewer installation, /usr/bin/cadviewer, for example use npm:
user@user-VirtualBox:~$ pwd
/usr/bin/cadviewer
user@user-VirtualBox:~$ sudo npm install http-server -g
user@user-VirtualBox:~$ http-server -p 8080
Starting up http-server, serving ./
Available on:
http://127.0.0.1:8080
http://10.0.2.15:8080
Hit CTRL-C to stop the server
Open a web-browser pointing to your sample html file: http:/127.0.0.1/8080/html/mysample.html
Use the server traces and browser development console for debugging, alternatively contact our Support
Troubleshooting
One issue that often appears in installations is that interface icons does not display properly:
Typically the variable ServerUrl in /cadviewer/app/cv/CADViewer_NodeJSHandlerSettings.js is not set to reflect the front-end server url or port.
Server Source Code - Windows and Linux
The NodeJS server code is similar on Windows and Linux, the latest version is CVServer-v6_1_1.js . Application programmers may modify content to integrate with their own software or application.