multiroot
v3.1.0
Published
A static file server with > 1 document root
Downloads
2
Readme
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
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