---
title: Handling Node.js Request Bodies with Vercel
description: Parse Node.js request bodies for use inside Serverless Functions deployed with Vercel.
url: /kb/guide/handling-node-request-body
canonical_url: "https://vercel.com/kb/guide/handling-node-request-body"
published: 2025-11-03
last_updated: 2026-06-15
authors: Matthew Sweeney
related:
  - /docs/concepts/functions
  - /docs/concepts/functions/serverless-functions/runtimes/node-js
  - /blog/vercel-node-helpers
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---
<!-- docsgraph:related -->
## Related pages

> **For AI agents:** Follow these links to understand how this page connects to the rest of the Vercel ecosystem. For the full cross-link map (inbound, outbound, prerequisites, and semantic neighbors), see the .graph.md link below.

- [Node.js](https://vercel.com/docs/functions/runtimes/node-js?from=related) — Learn how to use the Node.js runtime to create functions and deploy Node.js servers on Vercel.
- [Getting Started](https://vercel.com/docs/functions/quickstart?from=related) — Build your first Vercel Function in a few steps.
- [Functions](https://vercel.com/docs/functions?from=related) — Run server-side code on Vercel without managing a server.
- [Advanced Node.js Usage](https://vercel.com/docs/functions/runtimes/node-js/advanced-node-configuration?from=related) — Learn about advanced configurations for Vercel functions on Vercel.
- [How do I get the raw body of a Serverless Function?](https://vercel.com/kb/guide/how-do-i-get-the-raw-body-of-a-serverless-function?from=related) — Learn how to disable body parsing for Vercel Serverless Functions to enable reading the raw data from a POST request.
- [How do I bypass the 4.5MB body size limit of Vercel Serverless Functions?](https://vercel.com/kb/guide/how-to-bypass-vercel-body-size-limit-serverless-functions?from=related) — Learn how to deal with the body size limit of Serverless Functions on Vercel.
- [Using Express.js with Vercel](https://vercel.com/kb/guide/using-express-with-vercel?from=related) — Learn how to use Express.js in a Serverless environment.
- [How can I use AWS S3 with Vercel?](https://vercel.com/kb/guide/how-can-i-use-aws-s3-with-vercel?from=related) — Example how to use AWS S3 library on Vercel
- [Processing Data Chunks](https://vercel.com/kb/guide/processing-data-chunks?from=related) — Learn how to create an API endpoint that processes data chunks.

Full cross-link map for this page: [/kb/guide/handling-node-request-body.graph.md](/kb/guide/handling-node-request-body.graph.md)
<!-- /docsgraph:related -->


In this guide, we will show you how to parse a [Node.js request body](https://nodejs.org/learn/http/anatomy-of-an-http-transaction#anatomy-of-an-http-transaction), for use inside a [Serverless Function](https://vercel.com/docs/concepts/functions#serverless-functions) deployed to [Vercel](https://vercel.com/), without requiring a framework such as Express.

This guide assumes the request is sent with a [Content-Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) of [application/json](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON). However, many more content types can be parsed if required.

## Step 1: Creating the Function

To get started, create a project directory with an `/api` directory inside and `cd` into it:

```bash
mkdir req-body && mkdir req-body/api
cd req-body
```

To illustrate the parsing of a request body, create an `index.js` file inside your `/api` directory with the following code:

```javascript
export default async function handler(req, res) {
  const { body } = req;
  return res.send(`Hello ${body.name}, you just parsed the request body!`);
}
```

This function takes a POST request, parses the body, and uses data from the body in the response.

The key part here is line 2. [Vercel](https://vercel.com/) adds a number of Express like [helper properties](https://vercel.com/docs/concepts/functions/serverless-functions/runtimes/node-js#node.js-helpers) to make wording with Node.js even easier.

> \*\*Note: \*\*You can read more about [helper properties](https://vercel.com/docs/concepts/functions/serverless-functions/runtimes/node-js#node.js-helpers) either in the [blog post](https://vercel.com/blog/vercel-node-helpers) or in the [documentation](https://vercel.com/docs/concepts/functions/serverless-functions/runtimes/node-js#node.js-helpers).

With the `req.body` helper, the incoming `request` is parsed automatically, removing the need for third-party libraries or further code to handle the [ReadableStream](https://nodejs.org/api/stream.html#stream_class_stream_readable) format the `request` normally arrives in.

## Step 2: Deploying the Function

Deploying your function to [Vercel](https://vercel.com/) can be done with **a single command**:

```bash
vercel
```

You have now created and deployed your project, all that's left to do is test that it works.

## Step 3: Sending the Request

To verify that the JSON is being parsed correctly, make a POST request to your new deployment using [curl](https://curl.haxx.se/) by executing the below code inside your terminal:

```bash
curl -X POST "https://your-deployments-url.vercel.app/api" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Reader"
}'
```

> \*\*Note: \*\*You should change the URL to match the one for your deployment given to you in the Vercel CLI.

You will receive a response similar to the following:

```text
Hello Reader, you just parsed the request body!
```

Congratulations, now you know how to parse request bodies with [Vercel](https://vercel.com/) in Node.js!

## Bonus: Understanding Why this Works

When [Node.js](https://nodejs.org/docs/latest-v8.x/api/) receives a request, the [body](https://nodejs.org/learn/http/anatomy-of-an-http-transaction) is in the format of a [ReadableStream](https://nodejs.org/api/stream.html#stream_class_stream_readable).

To get the data from the stream, you need to listen to its `data` and `end` events. To do this requires a few lines of code which you would much rather not have to repeat.

By using [helper properties](https://vercel.com/docs/concepts/functions/serverless-functions/runtimes/node-js#node.js-helpers), the `request` is already parsed for you, allowing you to access the data immediately.