const server = new StaticServer(0) // let server choose a random available port
await server.start()
console.log(server.port) // will print '0'
Problem: server.port will be 0, while we want it to be the actual port that was chosen by the server. Not knowing the port were the server is running makes this whole package entirely useless.
Workaround: what I'm doing is:
const server = new StaticServer(0)
const origin = await server.start() // 'http://localhost:63051'
const port = parseInt(origin.split(':').slice(-1)[0])
Suggested solution: update start() function to save the port
Problem:
server.port
will be0
, while we want it to be the actual port that was chosen by the server. Not knowing the port were the server is running makes this whole package entirely useless.Workaround: what I'm doing is:
Suggested solution: update
start()
function to save the port