cURL to Node.js

Paste a curl command and get Node.js code using axios — or pick any other language.

Paste a curl command above to generate code

How curl maps to Node.js (axios)

  • →The output uses axios; Node.js 18+ also has fetch built in — switch to JavaScript (fetch) if you'd rather avoid a dependency.
  • →axios parses JSON responses automatically into res.data.
  • →-u user:password becomes a Basic Authorization header; axios also accepts auth: { username, password }.

Frequently asked

Do I need axios to make HTTP requests in Node.js?

No. Node.js 18 and later include fetch. axios adds automatic JSON parsing, interceptors and timeouts, which is why many projects still use it.

How do I send JSON with axios?

Pass an object as data and axios serializes it and sets Content-Type: application/json. The converter keeps the body exactly as curl sent it.

ToolNinja