【问题标题】:In Windows 10 Console run a "PORT"在 Windows 10 控制台中运行“端口”
【发布时间】:2021-01-02 20:53:33
【问题描述】:

Wie führe ich in der normalen Windows 10 Console ein "Port" aus bzw。 das hier: "PORT=3001 node bin/www"?

【问题讨论】:

  • 我投票结束这个问题,因为它是用德语写的。 Stack Overflow 是一个英文网站。翻译或查找德语等价物

标签: javascript reactjs express


【解决方案1】:

首先安装 NodeJS。

然后保存文件以Copy文件到C:\为例。

然后创建 C:\myapp.js

然后

  var http = require('http');
  http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello\n');
  }).listen(3001, "127.0.0.1");
  console.log('Server running at http://127.0.0.1:3001/');

然后去开始 -> 运行... -> cmd

导航到 c: 并执行 C:>node myapp.js

这是我能想到的最原始的示例,但最好在 Visual Studio Code 之类的编辑器中简单地使用 Express 并在其中运行终端。

【讨论】:

    猜你喜欢
    • 2020-08-03
    • 2018-10-02
    • 2019-07-21
    • 2023-03-31
    • 1970-01-01
    • 2015-08-25
    • 2011-09-23
    • 2023-04-11
    • 2022-12-31
    相关资源
    最近更新 更多