Server Setup

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 Middleware

We provide a demo configuration using the Xeditor Middleware. If you want to use the Middleware 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 Middleware 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 Middleware

If you don't want to use the Middleware, 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 Middleware, as your server has to perform mostly the same tasks.

The Middleware 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 Middleware 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 Middleware. On the example of the load service, it will describe how to implement Xeditor core services.

  1. Open the configuration file of the Middleware server called xemiddleware.config.mjs.

  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 Middleware.

Now, Xeditor will send a load request to the Middleware server when loading. The Middleware will send this request to your just created server. Your server will then respond with read XML and the Middleware 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.