We recommend using our
@commercetools-frontend/mc-http-server package to run the application in
@commercetools-frontend/mc-http-server has built-in functionality that is necessary for the application to work. Most importantly:
- Compiling the
index.htmlto inject the runtime configuration in the
- Preparing the HTTP response headers, including the custom
headers.jsonconfiguration (Content Security Policy).
The package comes with a binary
mc-http-server that sets up all the necessary configurations and starts a small Node.js server.
mc-http-server --config $(pwd)/env.json --headers $(pwd)/headers.json
A pre-built Docker image (
eu.gcr.io/ct-images/mc-http-server) is also available for running the application in a Docker environment:
docker pull eu.gcr.io/ct-images/mc-http-serverdocker run \-v $(pwd):/etc/app \-p 8080:8080 \eu.gcr.io/ct-images/mc-http-server \--config /etc/app/env.json \--headers /etc/app/headers.json
The version of the Docker image is the same as the last release of the