首页 > 解决方案 > Node.js Express - 客户端下载栏?

问题描述

我有一个Node.js服务器使用Express

const socketio      = require('socket.io'),
      http          = require('http'),
      path          = require('path'),
      express       = require('express'),
      app           = express(),
      serv          = require('http').Server(app),
      cors          = require('cors');

var htmlPath = path.join(__dirname, 'client_data');
    
app.use(cors(corsOptions), express.static(htmlPath));
app.get('/', cors(corsOptions), (req, res, next) => {
    res.sendFile(htmlPath + '/index.html');
});

客户端通过连接

function init() {
    var url = 'http://192.168.1.5:8080';
    window.open(url, 'theFrame');
}

我正在尝试为Download Progress Bar通过 Express 检索到的文件添加一个用于客户端(也可以用于服务器端)。这可能吗?谢谢!

标签: javascriptnode.jsexpress

解决方案


推荐阅读