TransWikia.com

How can i do a request an external url?

Stack Overflow Asked by mikkylekyle on January 12, 2021

How can do a request to endpoint from express.js? i want to do a POST request to an url external,
i am using request library but this is deprecated also i want to send this data req.body.options

app.post(
  'sendData',
  async (req, res) => {
    var url =
      'http://myUrl'
    request.post(
      url,
      {
        options : req.body.options,
      },
      (error, res, body) => {
        if (error) {
          console.error(error)
          return
        }

I have tried but dont work that code, i want to use http

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP