![]() |
VOOZH | about |
The `app.delete()` function is utilized to handle HTTP DELETE requests for a specified path. It takes the path as a parameter and also accepts callback functions as parameters to handle the request.
Syntax:
app.delete(path, callback)Parameters:
app.delete() function is basically used to handle DELETE requests in Express.js.
Step 1: You can install this package by using this command.
npm install expressStep 2: After installing the express module, you can check your express version in the command prompt using the command.
npm version expressStep 3: After that, you can just create a folder and add a file, for example, index.js. To run this file you need to run the following command.
node index.jsProject Structure:
👁 NodeProjThe updated dependencies in package.json file will look like:
"dependencies": {
"express": "^4.18.2",
}
Example: Below is the example of the app.delete() Function:
Steps to run the program:
node index.jsConsole Output:
Server listening on PORT 3000Browser Output: Now make a DELETE request to http://localhost:3000/ and you will get the following output:
DELETE Request Called We have a complete list of all the important Express Application Module methods, to check those please go through Express Application Complete Reference article