Nx节点应用程序响应“ Websoket连接预期响应”

时间:2019-11-11 14:52:05

标签: nrwl nrwl-nx

我正在尝试nrwl / nx(@ angular / cli:8.3.18)并使用以下命令生成了一个节点应用程序:

$ npx ng add @nrwl/node
$ npx ng g @nrwl/node:app api --unit-test-runner none --directory .

angular.json的发球部分如下:

...
"serve": {
  "builder": "@nrwl/node:execute",
  "options": {
    "buildTarget": "api:build",
     "port": 3000
   }
},
...

然后,我将一个基于koa2的REST api应用程序样本复制到apps/api/中,并从npx ng serve开始。该应用程序已启动,但是尝试卷曲到它时,我收到了“ WebSockets请求已预期”而不是JSON响应。我想念什么?

curl -v http://localhost:3000
* Rebuilt URL to: http://localhost:3000/
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 3000 (#0)
> GET / HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.54.0
> Accept: */*
> 
* HTTP 1.0, assume close after body
< HTTP/1.0 400 Bad Request
< Content-Type: text/html; charset=UTF-8
< 
WebSockets request was expected
* Closing connection 0

0 个答案:

没有答案