小编Ble*_*lex的帖子

Node.js教程Web服务器没有响应

我在尝试启动Node.js时正在查看这篇文章,我开始使用本指南来学习基础知识.

我的服务器的代码是:

var http = require('http');

http.createServer(function (request, response) {
    request.on('end', function() {
        response.writeHead(200, {
            'Content-Type' : 'text/plain'
        });
        response.end('Hello HTTP!');
    });
}).listen(8080);
Run Code Online (Sandbox Code Playgroud)

当我去localhost:8080(根据指南),我得到一个'没有数据收到'错误.我看到一些页面说https://是必需的,但是会返回'SSL Connection Error'.我无法弄清楚我错过了什么.

javascript node.js

6
推荐指数
1
解决办法
6640
查看次数

标签 统计

javascript ×1

node.js ×1