Socket
Socket
Sign inDemoInstall

multi-user-dev-server

Package Overview
Dependencies
335
Maintainers
13
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    multi-user-dev-server

Create a webpack dev server that supports multiple users (or configs) on one port.


Version published
Maintainers
13
Created

Readme

Source

multi-user-dev-server

This creates a web service that runs webpack --watch for multiple users/configs. It can be controlled by a simple web API.

Example

Try example/app.js with

npm install
npm start

curl --data '' http://localhost:8080/bundle/user1
curl --data '' http://localhost:8080/bundle/user2

curl --data '' http://localhost:8080/reload/user1
curl --data '' http://localhost:8080/reload/user2

Usage

const multiUserDevServer = require('multi-user-dev-server');

const app = multiUserDevServer(username => {
  return {
    // The path to this user's webpack config
    configPath: `${__dirname}/${username}/webpack.config.js`,
    // The `env` to pass into the webpack config
    webpackEnv: {},
    // What to respond with for `GET /:username` (optional)
    successResponse: `Bundle completed in ${__dirname}/${username}`,
  };
}, 3600 /* seconds after which unaccessed webpack instances will be stopped */);

app.listen(8080);

Server API

Start building username's webpack bundle and wait until it completes. If it's already building, this will wait to respond until building is complete.

POST /bundle/:username

Reload username's webpack config.

POST /reload/:username

FAQs

Last updated on 19 Jan 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc