Skip to content

FileMode

Luis Huertas edited this page May 9, 2022 · 1 revision

Instead of prefix your variables with SPAVAR, inspired on the java spring boot framework, you could create a settings.json file at the root with these values:

{
  "foo": "bar",
  "employeeApiBaseUrl": "${EMPLOYEE_API_BASE_URL}"
}

Just ensure that that variable exist before the start of server:

#linux
export EMPLOYEE_API_BASE_URL=https://employee-api.com

#windows
set EMPLOYEE_API_BASE_URL=https://employee-api.com

Add the -s settings.json parameter:

"start": "nodeboot-spa-server dist -s settings.json -p 8080 --allow-routes",

When you start the app with npm run start you will have the /settings.json ready to use a the entrypoint of your spa:

{
  "foo": "bar",
  "employeeApiBaseUrl": "https://employee-api.com"
}

Clone this wiki locally