Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @pubcore/node-server-docker with all npm packages installed. Try it out:

var nodeServerDocker = require("@pubcore/node-server-docker")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@pubcore/node-server-docker v1.4.1

node server composed with docker

Create an ECMAScript (JavasScript) web server based on Node.js, express and docker

How to run/test this package, standalone on your local system

  1. latest version of docker, node and npm installed and running

  2. change to your development folder, where you may have other projects and clone this repository into it (which will create the project-dir)

     git clone git@github.com:pubcore/node-server-docker.git         
    
  3. find/create ssl key- and certificate-files (ssl-files) for your local domain ... you need it for next step

  4. switch docker to swarm mode

     docker swarm init
    
  5. register secrets
    Create dhparam.pem file used below with (replace <pathToFile> with directory where the ssl-files stored in:

     openssl dhparam -out <pathToFile>dh-strong.pem 2048
    

Register keys and certificates created for your domain you are running your (local) development system

    docker secret create ssl-key <absolute path to ssl key file>
    docker secret create ssl-cert <absolute path to ssl crt (certificate) file>
    docker secret create ssl-dhparam <absolute path to dh-strong.pem file>
  1. change into project-dir

  2. register configs

     docker config create verdaccio ./verdaccio-config.yml
    
  3. install application packages

     npm install
    
  4. start server

    npm run start
    
  5. test it: you should see "Hello world!"

    https://<your-local-domain>:8443/
    

Configuration environment variables

  • APP_PORT
    Application's ports
  • NODE_ENV
    Type of environment, either 'development' or 'production'
  • RATE_WIN, RATE_MAX, RATE_DELAY
    Rate limit values, see https://www.npmjs.com/package/express-rate-limit
    Default values (Window: 5 min, Max: 300, Delay: 0)
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free