Sample App
Please contact NuraLogix to get access to the WMS sample application which demonstrates the call-in / callback functionality of Web Measurement Service (WMS)
The sample app consists of a backend component that obtains an authorization token and a refresh token from DeepAffex API and a frontend component which uses a simple UI to collect user information, calls in to WMS and displays the returned results using a simple UI.
Building and testing the sample app
Running for Testing & Development
Note: Please use yarn
to install dependencies as npm
causes some
dependency issues.
Please rename .env.template
to .env.development.local
or .env.production.local
depending upon the environment and then assign the correct configuration values
before running the sample app. Please note that the Docker image is configured to
use .env.production.local
.
Property | Description |
---|---|
FRONTEND_APP_WMS_URL | Enter CNAME here after CNAME setup is confirmed by NuraLogix. Use default URL https://awe.na-east.nuralogix.ai if CNAME is not configured. |
FRONTEND_APP_TWO_WAY_ENCRYPTION | Set to true for enabling two-way encryption. |
PUBLIC_URL | Populate only if the app will be run from a sub-path, example: /subpath otherwise leave blank. |
ENCRYPT_RESULTS | Set to true for enabling result encryption. |
APP_PORT | Enter port if needed, otherwise leave blank. |
CONFIG_ID | An identifier for your specific app configuration. |
APP_NAME | Application name used for reporting purposes only (e.g., if more than one app will be calling Web Measurement Service). |
APP_IDENTIFIER | Application ID used for reporting purposes only (e.g., if more than one app will be calling Web Measurement Service). |
API_URI | URL of the DeepAffex API (usually api.deepaffex.ai ). |
LICENSE_KEY | DeepAffex API license (obtained from DeepAffex Dashboard). |
PRIVATE_KEY | Generated by you for results decryption and signing user profile data. |
PUBLIC_KEY | Generated by you for results encryption. |
WMS_PUBLIC_KEY | Generated by Nuralogix and shared with you for user profile encryption. Also used to verify the measurement results signed by Nuralogix. |
RSA_PUBLIC_KEY | Public key for legacy encryption flow. Leave blank if you are using two-way encryption. |
Please note that you must set both FRONTEND_APP_TWO_WAY_ENCRYPTION and ENCRYPT_RESULTS
to true
to enable two-way encryption or set both to false to disable two-way encryption.
If you want to know about one-way encryption, please refer to Legacy Encryption.
Steps
# install dependencies
yarn
# build the client
yarn build:dev
# run the app
yarn serve:dev
Sample app details
The sample app consists of a server component and a client component. The server component acts as a back-end for providing REST endpoints for saving the config ID and for generating DeepAffex tokens. It is also responsible for serving pre-built static assets. The client component acts as a front end for hosting the user profile form, making REST API calls to the back-end component and for hosting the results page.
Endpoints used by the client component to communicate with the server component in the sample app
/health
Used to check the health of the backend, required for deployment checks.
/api/configId
Returns the application specific configuration ID, this is a fixed value provided by Nuralogix.
/api/token
Returns a DeepAffex authorization token and a refresh token, those tokens are then passed to WMS for DeepAffex licensing.
/api/encryptProfile
Accepts profile object data and returns an encrypted payload.
/api/decryptResults
Accepts encrypted measurment results payload and returns a json measurment data object
/api/settings
Returns custom settings that override and/or extend the default config values.
/api/status
Can be used in the deployment to check if the application is up and running.
Endpoints used by the server component in the sample app to communicate with the DeepAffex API
/organizations/licenses
Used to get a device token and a refresh token from the DeepAffex API. Those tokens are then passed to the front-end which passes it to WMS for DeepAffex licensing.
/organizations
Retrieves information related to the current organization.