socket.io and differents folders — solution found

前端 未结 5 1502
轮回少年
轮回少年 2020-12-18 09:39

I\'m new to socket.io and i already have a problem, minor i think. I have installed node.js properly and socket.io too with npm. Then just for testing i cut and paste a sam

5条回答
  •  孤城傲影
    2020-12-18 10:24

    You can use mime module as well:

    var mime = require('mime')
      , content_type = mime.lookup(filePath);
    
    // handle the request here ...
    
    response.setHeader('Content-Type', content_type);
    response.writeHead(200);
    response.end(data);
    

提交回复
热议问题