Express.js Post – javaTpoint
Express.js POST Request
GET and POST both are two common HTTP requests used for building REST API’s. POST requests are used to send large amount of data.
Express.js facilitates you to handle GET and POST requests using the instance of express.
Express.js POST Method
Post method facilitates you to send large amount of data because data is send in the body. Post method is secure because data is not visible in URL bar but it is not used as popularly as GET method. On the other hand GET method is more efficient and used more than POST.
Let’s take an example to demonstrate POST method.
Example1:
Fetch data in JSON format
File: Index.html
File: post_example1.js
Open the page index.html and fill the entries:
Now, you get the data in JSON format.
Note: In the above picture, you can see that entries are not visible in the URL bar unlike GET method.
Next Topic
ExpressJS Routing