Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

117
Visualizações
How to access PUT/POST/DELETE endpoints on browser directly from backend without UI connectivity

How to use PUT/POST/DELETE methods in NodeJS directly in browser?

router.put('/sync/:syncId', (req, res) => {
    res.send(JSON.stringify({ "status": 200, "error": false, "response": "HELLO WORLD" }));
});

This is how I access the endpoint in the browser and Postman:

http://localhost:4600/v1/fetchprojdetails/delete/1

When I use the above code on browser, then the router kind of acts weird and doesn't work. It neither shows res.send() statement nor any console.log() statements if there are any in the above function but when I try the same thing on Postman using the respective HTTP method(PUT/POST/DELETE) then it works as it should. The same thing works when I change the above code and replace router.delete() with router.get().

Can someone please explain to me why this behavior is seen on browser and POSTMAN. Is it so that the browser can't directly understand PUT/POST and DELETE methods?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Postman is a tool designed to make custom HTTP requests so developers can test APIs. Browsers are tools designed to display webpages and run web applications embedded in them.

If you shove a URL into the browser's address bar then it will make a GET request. The address bar is a UI that affords getting a webpage and displaying it to the user.

If you want to make a POST request then you need to load an HTML document containing either a <form ... method="POST"> or JavaScript that makes an Ajax request.

If you want to use any other verb then you must use an Ajax request.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda