Olá, não consigo fazer funcionar no Windows, uso o PowerShell e também o Cmder e nenhum dos dois funciona. Estou seguindo passo a passo do curso e nada.
Erro 1 - não reconhece o json_pp (Cmder)
curl http://localhost:3000/pagamentos/pagamento -X POST -v -H "Content-type: application/json" -d @files/pagamento.json | json_pp
'json_pp' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.
Erro 2 - Sem o json_pp da erro 500. (Cmder)
curl http://localhost:3000/pagamentos/pagamento -X POST -v -H "Content-type: application/json" -d @files/pagamento.json
Note: Unnecessary use of -X or --request, POST is already inferred.
* timeout on name lookup is not supported
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 3000 (#0)
> POST /pagamentos/pagamento HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.54.1
> Accept: */*
> Content-type: application/json
> Content-Length: 145
>
* upload completely sent off: 145 out of 145 bytes
< HTTP/1.1 500 Internal Server Error
< X-Powered-By: Express
< Content-Security-Policy: default-src 'self'
< X-Content-Type-Options: nosniff
< Content-Type: text/html; charset=utf-8
< Content-Length: 1158
< Date: Tue, 01 Aug 2017 16:22:12 GMT
< Connection: keep-alive
<
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>TypeError: app.persistencia.PagamentoDao is not a function<br> at C:\node\cartola\controllers\pagamentos.js:15:24<br> at Layer.handle [as handle_request] (C:\node\cartola\node_modules\express\lib\router\layer.js:95:5)<br> at next (C:\node\cartola\node_modules\express\lib\router\route.js:137:13)<br> at Route.dispatch (C:\node\cartola\node_modules\express\lib\router\route.js:112:3)<br> at Layer.handle [as handle_request] (C:\node\cartola\node_modules\express\lib\router\layer.js:95:5)<br> at C:\node\cartola\node_modules\express\lib\router\index.js:281:22<br> at Function.process_params (C:\node\cartola\node_modules\express\lib\router\index.js:335:12)<br> at next (C:\node\cartola\node_modules\express\lib\router\index.js:275:10)<br> at C:\node\cartola\node_modules\body-parser\lib\read.js:130:5<br> at invokeCallback (C:\node\cartola\node_modules\body-parser\node_modules\raw-body\index.js:262:16)</pre>
</body>
</html>
* Connection #0 to host localhost left intact
Erro com PowerShell
curl http://localhost:3000/pagamentos/pagamento -X POST -v -H "Content-type: application/json" -d @files/pagamento.json | json_pp
json_pp : The term 'json_pp' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name,
or if a path was included, verify that the path is correct and try again.
At line:1 char:123
+ ... H "Content-type: application/json" -d @files/pagamento.json | json_pp
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (json_pp:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException