kdb web应用程序中出现“html/main.html:未找到”错误

kdb web应用程序中出现“html/main.html:未找到”错误,kdb,Kdb,我正在通过引用来使用websocket开发一个web应用程序 应用程序位于路径: Directory structure: /Users/repos/chatu/ -->html --> main.html --> main.js -->q --> main.q q)\pwd "/Users/repos/chatu" //- and main.html(index) is at path

我正在通过引用来使用websocket开发一个web应用程序

应用程序位于路径:

Directory structure:
/Users/repos/chatu/
    -->html
          --> main.html
          --> main.js
    -->q
          --> main.q


q)\pwd
"/Users/repos/chatu" //- and main.html(index) is at path /Users/repos/chatu/html/main.html 
当pwd为/Users/repos/chatu时,则该网页在浏览器上使用url-

但当pwd更改为任何其他目录时,例如

q)\pwd
"/Users/repos" 
然后点击与上面相同的url会抛出以下错误:

html/main.html: not found
我从错误中可以理解的是,web服务器在当前工作目录中需要html/main.html,但它无法找到它

如何/在何处设置index.html的绝对路径,使web浏览器可以从任何当前工作目录中找到main.html页面?无法找到/理解解决相同问题的任何答案

Code snippet -
main.js
function connect(){
    if ("WebSocket" in window) {
        ws = new WebSocket("ws://localhost:5001/");
        output.value="connecting...";
        /* ws.onopen=function(e){output.innerHTML="connected"}; */
        ws.onclose=function(e){output.innerHTML="disconnected"};
        ws.onerror=function(e){output.value=e.data};
        /*
            when a message is received,
            prepend the message to the display area
            along with the input command
        */
        } else alert("WebSockets not supported on your browser.");
    }

main.html
<!doctype html>
<html>
<head>
    <title>Chatu</title>
    <style>
        /* define some CSS styling on page elements */
        div#wrap{
            width:100%;
            overflow:auto;
        }
        textarea#txtInput {width: 97.5%; height: 60px; float:left; padding: 10px; margin-top: 10px;}
        div#txtOutput{
            width: 97.5%; height: 300px; font-family: "Courier New"; padding: 10px;
            border: 1px solid gray; margin-top: 2px; overflow:auto;
        }
    </style>
</head>
<body>
<div id="wrap">
<fieldset id='heads' style="border:1; border-radius:10px">
    <legend align="center" style="color:blue">Chatu</legend>
    <div id="txtOutput"></div>
    <textarea id="txtInput" autofocus></textarea>
</fieldset>
</div>

</body>
<script type="text/javascript" src="main.js"></script>
</html>

main.q
.z.ws:{neg[.z.w].j.j @[.da.mf;x;{`$ "'",x}];};

.h.HOME是您感兴趣的变量


.h.HOME是您感兴趣的变量


我相信,正如您在kdb web应用程序中所描述的那样,为索引html设置绝对路径的方法是使用.h.HOME分配此路径

变量.h.HOME是一个字符串,其中包含Web服务器根目录的位置


如果您想了解关于.h.HOME的更详细说明,请参阅

,我相信,正如您在kdb web应用程序中所述,为索引html设置绝对路径的方法是使用.h.HOME分配此路径

变量.h.HOME是一个字符串,其中包含Web服务器根目录的位置

如果您想了解有关.h.HOME的更详细说明,请参阅