Setting up the Login Server
Set up and configure the Login Server for the Reference Chatbot (Facebook Messenger). The Login Server is the authentication bridge between the Reference Chatbot and the Facebook Messenger services.
Configuration Parameter Descriptions
You must configure the following parameters in the ./src/ep.config.json file:
| Parameter | Importance | Type | Description |
|---|---|---|---|
cortexApi.path | Required | String | The URL, which is composed of the hostname and port, to access Cortex. By default, a web proxy is configured in the Webpack configuration of the project. For local development, set this value to /cortex to redirect Cortex calls to the local proxy. |
cortexApi.scope | Required | String | Name of the store from which Cortex retrieves data. |
cortexApi.pathForProxy | Required | String | The path to which the Webpack proxy routes the Cortex calls from the storefront. This value is a URL that consists of hostname and port of a running instance of Cortex. Leave this field blank to disable proxy. |
Setting up a Development Environment
Ensure you have read through the documentation here
Run the
cd logincommandTo install dependencies, run the
npm installcommandConfigure the
./src/ep.config.jsonfile as required for the environment.For more information, see the Configuration Parameter Descriptions section.
To start the server in development mode, run the
npm startcommandTo see the running Reference Chatbot Login Page, go to
http://localhost:9000/
Setting up a Production Environment
Ensure you have read through the documentation here
Run the
cd logincommandTo install dependencies, run the
npm installcommandConfigure the
./src/ep.config.jsonfile as required for the environment.For more information, see the Configuration Parameter Descriptions section.
To build the application in production mode, run the
npm run buildcommand.This Builds the application for production to the
buildfolder. It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.You can host the built files on a web server of your choice.
To the running Reference Chatbot Login Page, go to
http://localhost:9000/.
The application contains a Docker folder that contains a Dockerfile, a Shell script, and an Nginx configuration file.
- The Dockerfile uses a NodeJS image and an Nginx image, and uses the Production environment. The Dockerfile contains two arguments (
SCOPEandCORTEX_URL) that you can populate using the--build-argargument when creating the Docker image. - The Shell script populates the configuration file according to the arguments that are passed to the Docker image.
- The Nginx configuration exposes the built files that are created by the Dockerfile when running
npm run build.