1
我是dart的編程新手,我正在構建dart應用程序,我想從服務器端啓動dart應用程序。喜歡加載我的主頁,當我輸入我的網頁的網址。從服務器啓動dart應用程序並加載元素
在我的服務器端我有這樣的代碼,我從教程了從DART的網頁:
var server;
try{
server = await HttpServer.bind(InternetAddress.LOOPBACK_IP_V6, 4040);
}catch(e){
print("Couldn't bind to port 4044: $e");
exit(-1);
}
await for(HttpRequest req in server){
var file = new File('index.html');
if(await file.exists()){
print("Serving index.html.");
req.response.headers.contentType = ContentType.HTML;
try{
await file.openRead().pipe(req.response);
}catch(e){
print("Couldn't read file: $e");
exit(-1);
}
}else{
print("Couldn't open index.html");
req.response..statusCode = HttpStatus.NOT_FOUND..close();
}
}
但現在我的問題是關於客戶端,我的元素不加載,如CSS,圖像等。
You can see the appearance here
我想我需要在我的服務器端設置的東西加載。它是什麼?
我假設你的服務你的飛鏢服務器所產生的運行上的飛鏢瀏覽器應用程序'酒館build'的輸出('編譯/網絡/ **')? –