HTTP Server
One of the necessary steps to prepare your Custom Application for a deployment is to create a production build. If you decide to host your Custom Application in a Node.js runtime environment and do not intend to host your Custom Application statically, you can use our pre-configured HTTP server.
This section helps prepare your Custom Application for running it in an HTTP server.
Prerequisites
Before you get started, you need to do the following:
- Configure your Custom Application.
- Create a production build of your Custom Application.
NPM package
A pre-configured NPM package @commercetools-frontend/mc-http-server
is available for running the Custom Application as a Node.js HTTP server.
The server handles the necessary requests to serve the Custom Application. When the server starts it:
- Compiles the
index.html.template
into theindex.html
. - Prepares the HTTP response headers, including the custom headers provided in the Custom Application config.
To start the HTTP server simply run:
mc-http-server --use-local-assets
The --use-local-assets
option might not be necessary, depending on how and where your Custom Application is hosted. See Serving static assets for more information.
Docker image
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
The version of the Docker image is the same as the last release of the merchant-center-application-kit
.