• leslee
    2019-10-27
    听口音是广州本地人. 哈哈

    作者回复: 犀利啦你,听得甘认真

     1
     3
  • shengnan
    2019-12-02
    这里好像要把fs读取文件返回的结果转成string给send函数才可以,不然会直接返回一个文件下载,不知道是不是我的express版本问题
    app.get('/', (req, res) => {
        res.send(fs.readFileSync(__dirname + '/index.html').toString())
    })

    作者回复: readFileSync要传第二个参数(编码)返回的才会是字符串

    
    
  • lws
    2019-11-13
    能讲一下socket吗?谢谢!

    作者回复: 下几节课就有了

    
    
  • TechCheng
    2019-11-07
    老师,index.html中,应该加下 window.history.replaceState(null, null, `http://${location.host}/game?action=${key}`);,这样实验起来,更加直观点
      Object.keys($button).forEach(key => {
            $button[key].addEventListener('click', function () {
                fetch(`http://${location.host}/game?action=${key}`)
                    .then((res) => {
                        window.history.replaceState(null, null, `http://${location.host}/game?action=${key}`);
                        return res.text()
                    })
                    .then((text) => {
                        $output.innerHTML += text + '<br/>';
                    })
            })
        })
    展开

    作者回复: 对的,这样会更好,感谢指正

    
    
我们在线,来聊聊吧