Skip to content

Host SPA in Domino REST API with ReactJS

The Domino REST API allows hosting SPA in its keepweb.d directory. This page highlights the procedure to make this work with ReactJS.

Warning

If you’re not familiar with ReactJS, this topic may not be the best starting point. Instead, consider learning about open standards. However, if you’d like to explore React anyway, you can check out these tutorials.

Before you begin

  • You are familiar with ReactJS.

  • You have installed NodeJS and ReactJs CLI.

Procedure

In the steps below, the name of the application, and thus the folder name, will be mydominoreact. Each application needs its own name, so replace mydominoreact with the name of your choice. Following web conventions, use lowercase characters and nothing special in the name, especially no spaces or slashes in any direction.

  1. To ensure proper path resolution, you need to add PUBLIC_URL=/keepweb/mypromydominoreactject parameter to .env file.

    Note

    keepweb can be something else in your configuration.

  2. Reconfigure React to use HashRouter instead of BrowserRouter.

  3. Make sure that all links have %PUBLIC_URL% prefix. For example, for favicon.ico, it's <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">.

  4. Execute npm run build, or whatever build process you use.
  5. Rename build folder to mydominoreact and copy to the keepweb.d folder on your Domino server. To avoid the rename step, you can alter your build script to directly build into mydominoreact by adding to the .env file the entry BUILD_PATH='./mydominoreact'.