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.
This is not a ReactJS tutorial
When you are not familiar with ReactJS, this is not the place for you. Rather, learn open standards. But if you insist, check 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.
-
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. -
Reconfigure React to use HashRouter instead of BrowserRouter.
-
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">
. - Execute
npm run build
, or whatever build process you use. - Rename
build
folder tomydominoreact
and copy to thekeepweb.d
folder on your Domino server. To avoid the rename step, you can alter your build script to directly build intomydominoreact
by adding to the.env
file the entryBUILD_PATH='./mydominoreact'
.
Let's connect
We really like to hear from you!
Your opinion matters. Let us know all your:
- questions
- discussions
- ideas
- feedback
Join the OpenNTF Discord channel.