Solucionado (ver solução)
Solucionado
(ver solução)
4
respostas

Eu não sei se o Curl está ou não pegando

Eu uso o windows. E dei o comando curl http://localhost:3000/pagamentos/pagamento e veio a seguinte resposta

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /pagamentos/pagamento</pre>
</body>
</html>

ai depois eu dei o comando: curl http://localhost:3000/pagamentos/pagamento -X POST

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /pagamentos/pagamento</pre>
</body>
</html>

ai quando eu viu dar o comando : curl http://localhost:3000/pagamentos/pagamento -X POST -v

  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.55.1
> Accept: */*
>
< HTTP/1.1 404 Not Found
< X-Powered-By: Express
< Content-Security-Policy: default-src 'self'
< X-Content-Type-Options: nosniff
< Content-Type: text/html; charset=utf-8
< Content-Length: 160
< Date: Mon, 11 Mar 2019 14:26:02 GMT
< Connection: keep-alive
<
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /pagamentos/pagamento</pre>
</body>
</html>
* Connection #0 to host localhost left intact

No meu caso, não aparece o resp com OK, aparece o: < HTTP/1.1 404 Not Found. o que vocês acham que pode ser ?

4 respostas

Fala aí Yuri, tudo bem? Sua API está no ar? Estando rodando na porta 3000?

Você configurou as rotas para o pagamento?

Pelo jeito não está reconhecendo esse endereço.

Espero ter ajudado.

Não está conectando no servidor e não sei pq, se está tudo certo

C:\Users\YuriPNP\Desktop\pwd>node index.js
internal/modules/cjs/loader.js:651
    throw err;
    ^

Error: Cannot find module 'C:\Users\YuriPNP\Desktop\pwd\index.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:649:15)
    at Function.Module._load (internal/modules/cjs/loader.js:575:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:862:12)
    at internal/main/run_main_module.js:21:11
solução!

eu não sei o que era, refiz as aulas e agora tá pegando

Maravilha Yuri, desculpe a demora, está bem corrido por aqui.

Fico feliz que tenha conseguido resolver.

Abraços e bons estudos.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software