How to make an HTTP post request with Node

I am very new to node but I had to use it in a project to send a request to register my Bot. I read a lot of tutorials and I was lost at first, there were so many ways to make a post request but I couldn’t’ figure out which one to use.

However, here is the solution I used, using axios :

import axios from 'axios';

const url = '';
const body = {};
axios
  .post(url , body)
  .then((res: any) => {
    console.log(res.status)
  })
  .catch((error: any) => {
    console.error(error)
  })

My main source comes from this post: https://flaviocopes.com/node-http-post/

2 thoughts on “How to make an HTTP post request with Node

  1. Nice blog here! Also your web site loads up very fast! What host are you using? Can I get your affiliate link to your host? I wish my site loaded up as quickly as yours lol Charmaine Thorsten Waldos

    • Hello! Thanks for your nice comment. I’m using bluehost to host my website, it’s only been few months but I’m satisfied.

Comments are closed.

TheTrendyBrand