Closed sonoranDesert closed 9 years ago
Not quite yet, but I will look into this ASAP.
app.start
returns an HttpServer
so I am guessing this will work
void main() async {
var server = await app.start (port: 8080);
final virtualServer = new VirtualHost(server);
final domain1Stream = virtualServer.addHost('domain1.com');
new VirtualDirectory('/var/www/domain1').serve(domain1Stream);
}
Thanks for the quick responses.
@cgarciae In my case I get a "Bad state: Stream was already listened to" error when trying to do that, but I'll dig into that idea some more.
@sonoranDesert You can try this approach, should work
app.setupConsoleLog();
app.setUp();
HttpServer server = await HttpServer.bind('localhost', 7070);
final virtualServer = new VirtualHost(server);
final domain1Stream = virtualServer.addHost('domain1.com');
domain1Stream.listen(app.handleRequest);
I'll close this since @sonoranDesert failed to verify the answer.
Like how the http_server package does:
http://stackoverflow.com/a/21087254/607036