The app.put() function routes the HTTP PUT requests to the specified path with the specified callback functions.
app.put(path, callback [, callback ...])
- Path: The path for which the middleware function is invoked and can be any of:
- A string representing a path.
- A path pattern.
- A regular expression pattern to match paths.
- An array of combinations of any of the above.
- Callback: Callback functions can be:
- A middleware function.
- A series of middleware functions (separated by commas).
- An array of middleware functions.
- A combination of all of the above.
Installation of express module:
- You can visit the link to Install express module. You can install this package by using this command.
npm install express
- After installing express module, you can check your express version in command prompt using the command.
npm version express
- 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.
Steps to run the program:
- The project structure will look like this:
- Make sure you have installed express module using following command:
npm install express
- Run index.js file using below command:
Server listening on PORT 3000
Now make PUT request to http://localhost:3000/ and you will get the following output:
PUT Request Called
So this is how you can use the express app.put() function which routes HTTP PUT requests to the specified path with the specified callback functions.
- HandleBars Templating in ExpressJS
- Routing Path for ExpressJS
- Scaffolding an ExpressJS app from scratch
- How to get the function name inside a function in PHP ?
- D3.js | d3.max() function
- D3.js | d3.hsl() Function
- CSS | var() Function
- PHP | Ds\Set xor() Function
- PHP | Ds\Map put() Function
- D3.js zip() Function
- p5.js | nfs() Function
- p5.js | nfp() Function
- D3.js | d3.set.add() Function
- p5.js | nfc() function
- D3.js | d3.map.set() Function
- PHP | pow( ) Function
- PHP | end() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.