Skip to content

jessetane/multiroot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A static file server with > 1 document root

Resources

Stars

Watchers

Forks

Packages

No packages published