Skip to content

Server setup

Get up and running in a new environment.

Sample server code

When creating your server handling Xeditor services, you may want to take a look at our demo implementation in order to get a feeling for the required steps within each service.

Server along with Blackbox

We provide a demo configuration using the Xeditor Blackbox. If you want to use the Blackbox too, your integration may look very similar to the one we provided. Our demo server is written in JavaScript and can be found in two places:

  • In the demo configuration (@xeditor/xeditor-demo) it can be found in/node_modules/@xeditor/server-js/
  • As a standalone package. It can be downloaded by running:

    npm pack @xeditor/server-js --registry https://npm.xeditor.com:4873

As the Blackbox handles most of the Xeditor specific tasks, the integration server is mostly serving requested data, like requested XML and general data like images and user data.

Server without Blackbox

If you don't want to use the Blackbox, you have to make sure your server implementation takes care of all Xeditor specific tasks. For a starting point, you can take a look at the Blackbox, as your server has to perform mostly the same tasks.

The Blackbox is written in TypeScript, so you can have a look at both, the original TypeScript code as well as the compiled JavaScript code. The original TypeScript code will be placed in /src while the compiled JavaScript code will be placed in /dist. The Blackbox can be found in the following locations:

  • in your Xeditor package in /node_modules/@xeditor/blackbox/
  • As a standalone package. It can be downloaded by running

    npm pack @xeditor/blackbox --registry https://npm.xeditor.com:4873

How to: Setup your own server

This chapter will describe how to set up your own server and connect it to the Blackbox. On the example of the load service, it will describe how to implement Xeditor core services.

  1. Open the configuration file of the Blackbox server called xeblackbox.config.js.
  2. Locate the server object within the file and adjust its configuration to the host and port of your new server. It may look like this:

    [...] server: { host: '192.168.224.172', port: 3001 }, [...]

  3. Note

    This step depends on the language your server will be written in. In general, you can look at the code of the sample server provided with Xeditor as described in previous chapter and rebuild it on your environment.

    Create the necessary file(s) for your server.

  4. Create service that handles the load service (path: /editor/load).

  5. Add logic for reading XML from a file
  6. Send read XML as Response back to the Blackbox.

Now, Xeditor will send a load request to the Blackbox server when loading. The Blackbox will send this request to your just created server. Your server will then respond with read XML and the Blackbox will handle additional operations, like XSL transformation to Xeditor HTML with it. The result of the operation will then be send back to Xeditor and opened within it.