/web-eid-webextension-mock-webapp

A Node.js/Express/Handlebars mock web application for testing the Web eID browser extension

Primary LanguageJavaScriptMIT LicenseMIT

web-eid-webextension-mock-webapp

European Regional Development Fund

A Node.js/Express mock web application for testing the Web eID browser extension.

Setup

  1. Install the latest LTS version of Node.js - https://nodejs.org

    • Windows: Install Node.js via the official installer.
    • Linux and MacOS:
      • Option 1: Install Node.js and NPM via the official Node.js installer and optionally configure NPM global package path manually.
        The following steps can be skipped when running the project locally and when you don't need global packages! The following steps configure the NPM global package path, so that installing packages globally and running them does not require root or sudo. If you wish to run this project as a service on a server, then the recommended approach is to use a globally installed PM2 and then the following steps are necessary.
        1. On the command line, in your home directory, create a directory for global installations:
          mkdir ~/.npm-global
        2. Configure npm to use the new directory path:
          npm config set prefix '~/.npm-global'
        3. In your preferred text editor, open or create a ~/.profile file and add this line:
          export PATH=~/.npm-global/bin:$PATH
        4. On the command line, update your system variables:
          source ~/.profile
        5. To test your new configuration, install a package globally without using sudo
          npm install -g pm2
    • Option 2: Install Node.js and NPM via NVM (Node Version Manager). This option is recommended by NPM, but unless you need to switch between different Node.js versions quickly, I would recommend the first option instead. Manual configuration is more transparent.
  2. Clone the project

    git clone git@github.com:web-eid/web-eid-webextension-mock-webapp.git
  3. Install dependencies

    cd webextension-service-mock
    npm install
  4. Start the service

    npm run start
  5. Optionally use ngrok to serve your locally running service mock on an HTTPS connection. Get ngrok from https://ngrok.com/ and run it in a separate terminal.

    ngrok http 3000 --region=eu

    It should display something similar to this:

    Session Status    online
    Session Expires   7 hours, 59 minutes
    Version           2.3.35
    Region            Europe (eu)
    Web Interface     http://127.0.0.1:4040
    Forwarding        http://e569eb9def37.eu.ngrok.io -> http://localhost:3000
    Forwarding        https://e569eb9def37.eu.ngrok.io -> http://localhost:3000

    From there, use the HTTPS forwarding URL for testing.

Development

During development, start the service via npm run dev, this will:

  • Watch for changes in the project files
  • Run the linter when changes occur
  • Automatically restart the service