multiroot

3.1.0 • Public • Published

multiroot

A static file server with > 1 document root.

Why

Wanted an embeddable file server that could be reconfigured dynamically for small vhosting setups and tinkering.

How

ecstatic

Example

var server = new MultiRoot({ port: 8080 })

server.on('serve', path => {
  console.log('serve', path)
})

server.on('listen', port => {
  console.log('listening on ' + port) // 8080
})

server.apps = {
  a: {
    root: __dirname,
    singlePage: true // 'if a file is not found, the url will be changed to / and the handler retried 1x'
  },
  b: {
    root: __dirname + '/node_modules'
  }
}

server.names = {
  a: {
    appId: 'a'
  },
  b: {
    appId: 'b'
  },
  www.b: {
    appId: 'b'
  }
}

server.reload()

License

MIT

Dependents (0)

Package Sidebar

Install

npm i multiroot

Weekly Downloads

2

Version

3.1.0

License

MIT

Unpacked Size

6.79 kB

Total Files

4

Last publish

Collaborators

  • jessetane