freeCodeCamp/curriculum/challenges/chinese/05-apis-and-microservices/basic-node-and-express/meet-the-node-console.md

1.7 KiB

id title challengeType forumTopicId dashedName
587d7fb0367417b2b2512bed 认识 Node 的控制台 2 301515 meet-the-node-console

--description--

可以采用下面的任意一种方式完成这些挑战:

当完成本项目,请确认有一个正常运行的 demo 可以公开访问。 然后将 URL 提交到 Solution Link 中。

在开发过程中,能够随时看到代码的运行结果是非常重要的。

Node 只是一个 JavaScript 环境。 与客户端 JavaScript 一样,你可以使用控制台显示有用的调试信息。 在本地计算机上,你可以在终端中输出调试信息。 在 Repl.it 上,右侧边栏会默认打开一个终端。

我们建议在做这些挑战题时保持终端打开的状态。 通过这些终端的输出,你可能会发现这些错误的本质原因。

--instructions--

修改 myApp.js 文件,在控制台打印出 “Hello World”。

--hints--

控制台应该输出 "Hello World"

(getUserInput) =>
  $.get(getUserInput('url') + '/_api/hello-console').then(
    (data) => {
      assert.isTrue(data.passed, '"Hello World" is not in the server console');
    },
    (xhr) => {
      throw new Error(xhr.responseText);
    }
  );

--solutions--

/**
  Backend challenges don't need solutions, 
  because they would need to be tested against a full working project. 
  Please check our contributing guidelines to learn more.
*/