• micstone
    2019-10-15
    老师,加油更新,期待期待
    
     2
  • 雷敏
    2019-10-14
    老师,我写个一个小demo跟你一样的代码,可是运行的时候报错 the value “test.html”is ibvalid for option encoding.为什么呢??求解

    作者回复: 感觉是传参的位置错了,把文件路径传到了第二个参数去了。建议传到github上发出来看看

     1
     1
  • 唐小无
    2019-10-11
    老师 求你觉得一些写的不错的npm模块~ 麻烦啦

    作者回复: 太多了。建议你可以从各种著名的node框架的代码入手,看看它们使用到的npm模块。

    
     1
  • 郭风籥
    2020-01-05
    讲的很好
    
    
  • 杰妮蛇精病
    2019-11-03
    看到一半突然意识到为啥老师的脸看起来那么奇怪,刚潜完水没图防晒吧。。。面罩用的还是那款椭圆状的

    作者回复: 哈哈哈哈哈哈

    
    
  • Sky-fly
    2019-10-16
    Mark
    
    
  • 灵感_idea
    2019-10-15
    老师你也太实在了,“简单的介绍”还真简单呐,以为刚开个头,就没了,哈哈,等更新了
    
    
  • Geek_dd7b4e
    2019-10-14
    老师加油更新啊
    
    
  • 蚂蚁快跑
    2019-10-12
    H:\workspace\nodejs\http>node index.js
    events.js:187
          throw er; // Unhandled 'error' event
          ^

    Error: ENOENT: no such file or directory, open 'H:\workspace\nodejs\http\index.html'
    Emitted 'error' event on ReadStream instance at:
    ?[90m at internal/fs/streams.js:120:12?[39m
    ?[90m at FSReqCallback.oncomplete (fs.js:146:23)?[39m {
      errno: ?[33m-4058?[39m,
      code: ?[32m'ENOENT'?[39m,
      syscall: ?[32m'open'?[39m,
      path: ?[32m'H:\\workspace\\nodejs\\http\\index.html'?[39m
    }

    报错,看了文件路径是没问题的。代码如下:
    const http = require('http');
    const fs = require('fs');

    http.createServer(function (request, response) {

      if (request.url == '/favicon.ico') {
        response.writeHead(200)
        response.end()
        return;
      }

      response.writeHead(200)
      fs.createReadStream(__dirname + '/index.html').pipe(response)
    }).listen(3000)
    展开

    作者回复: 建议把代码也发出来看,比如放到github上之类的

     1
    
  • 刘彪
    2019-10-12
    怎么把html需要引入的资源一起返回给http请求

    作者回复: 实战篇会讲到

    
    
我们在线,来聊聊吧