In Dart language, the http_server package allows to implement virtual hosts.
import 'package:http_server/http_server.dart';
import 'dart:io';
void main() {
HttpServer.bind('localhost', 8080).then((server) {
var virtualServer = new VirtualHost(server);
virtualServer.addHost('domain1.com').listen(
(HttpRequest request) {
// what should I do now?
}
});
}
- How can I serve a web site in a subdirectory below /web/ using the http_server package?
- Is it best to place the web sites below the usual "web" directory?