Middle tier: Node.js Express
The example application communicates with MarkLogic through a Node.js Express server (the architecture's middle tier). The middle tier passes search requests to MarkLogic, returns search responses from MarkLogic, and applies HTTP headers to search requests to avoid any CORS obstacles. In a real-world application, the middle tier would also commonly handle authentication tasks. The UI will communicate with the middle tier through port 4001.
Install the middle-tier dependencies by running this command from the
fasttrack-getting-started/server
directory:npm install
Start the middle-tier server by running this command:
npm start
The middle-tier server gets its configuration information from a file at
server/config.js
. This file can be edited if necessary.