multi-user-dev-server

1.7.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i multi-user-dev-server

Weekly Downloads

9

Version

1.7.1

License

MIT

Unpacked Size

13.6 kB

Total Files

7

Last publish

Collaborators

  • sctice
  • danielbeardsley
  • masonmcelvain
  • michaellahargou
  • sterlinghirsh
  • addison0
  • davidrans
  • kwiens
  • 739curli
  • ardelato
  • ianrohde