Friday 20 September 2019

Does Node natively limit the size of data in the body of requests?

It is very simple to set up an api in node where you can accept various different requests, like POST or PUT requests where the user can send information in the body in the request.So I was wondering if node can natively limit the size of the data or if there are libraries/middlewares that can handle this in express or other api frameworks.An example would if I set up a POST endpoint where a user can create a Person with different properties like name, age and so on. So if the user decides to send multiple gigabytes worth of data in the request, how would one stop node from trying to load all of it in memory and crash the application due to node using up all the available memory.I know there are libraries to validate request bodies like Joi where you can for example specify the max amount of characters in a string but this can only be done after node handles the incoming request and saves all the data.

Submitted September 20, 2019 at 07:10PM by Royar1

No comments:

Post a Comment