
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@commercetools-frontend/mc-http-server
Advanced tools
Production HTTP server for running a MC application
This package contains the HTTP server to run a Custom Application in production.
This server should only be used for production, for development we use
@commercetools-frontend/mc-scriptsto start a development server.
$ npm install --save @commercetools-frontend/mc-http-server
We also provide a docker image to run the server:
$ docker run -p 3001:3001 eu.gcr.io/ct-images/mc-http-server:v0.0.0 mc-http-server
Since a Single Page Application consists of mainly JavaScript bundles and CSS, it's usually not necessary to have an actual HTTP server running. In theory it's enough to serve a static HTML page, for example from a Content Delivery Network (CDN).
However, the Custom Application requires certain information and configuration which cannot be provided on build time.
This information is available at runtime through environment variables, which needs to be dynamically injected into the index.html.
For that reason, before the server starts, we process the index.html.template that was previously generated on build time, containing references to the JavaScript bundles.
Additionally, there are some placeholders variables that are replaced with the values from the application config. After that, the final index.html file is written on disk and ready to be served by the HTTP server.
All static assets are served from the
publicfolder.
Besides generating and serving the index.html, the HTTP server does additionally a couple of things:
/metrics for Prometheus/version endpoint with the current revision hash (git SHA)FAQs
Production HTTP server for running a MC application
The npm package @commercetools-frontend/mc-http-server receives a total of 61 weekly downloads. As such, @commercetools-frontend/mc-http-server popularity was classified as not popular.
We found that @commercetools-frontend/mc-http-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.