簡體   English   中英

我的服務器文件出錯 - 無效的 URL:index.js

[英]Error with my server file - Invalid URL: index.js

嘗試運行我的服務器 (index.js) 時出現以下錯誤:

Error: TypeError [ERR_INVALID_URL]: Invalid URL: index.js

代碼塊在這里:

app.get('/:url', async function (req, res) {
      
      try {
    
      
        return res.status(200).json(data);
    
      } catch (ex) {
        console.log(ex);
        return res.status(500).json({ message : "Oops." });
        
      }

它所指的具體代碼行是:

const site = await .open(decodeURIComponent(req.params.url));

以前有沒有人遇到過這個錯誤,並且知道如何在這種情況下修復它? 不確定它是如何為我的整個 index.js 服務器引發錯誤的

注意:這是一個快遞應用

req.params.url的值為index.js

A web browser can expand index.js into an absolute URL because it knows that it can use the URL of the current HTML document as the base URL.

您正在 Node.js 中運行您的代碼。 它不在文檔中運行。 沒有基礎 URL。

您需要自己提供一個絕對值URL(例如http://example.com/index.js )。

也就是說,我懷疑 wappalyzer 可能要求您將 URL 提供給 HTML 文檔而不是 JS 文件。

好吧,由於我看不到您的使用情況,我只是假設您去了http://localhost/index.js類的東西。

現在的問題是,wappalyzer 實際上並沒有得到有效的 url。 它得到 index.js 沒有任何形式的協議(http/https/ws/wss...)。 這意味着它不知道該怎么做,並告訴您您提供的 url 無效。

In order to fix this go to http://localhost/https%3A%2F%2Flocalhost%2Findex.js or append https:// or something similar to your parameter.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM