January
19th,
2018
Hello all of you! from this article we are going to explore how to send POST requests from a Node.js Application. Node application using here is very much simple & very easy to understand.
For the easy coding we are using requests
npm package to send the requests. In requests
npm package you can find many easy http method implementations
- request.get(): Defaults to method: “GET”.
- request.post(): Defaults to method: “POST”.
- request.put(): Defaults to method: “PUT”.
- request.patch(): Defaults to method: “PATCH”.
- request.del() / request.delete(): Defaults to method: “DELETE”.
- request.head(): Defaults to method: “HEAD”.
- request.options(): Defaults to method: “OPTIONS”.
So lets directly go into the code
To run the code snippet
Step 1 - run npm init
to initiate a command line questionnaire that will conclude with the creation of a package.json in the directory
Step 2 - You first need to install related npm packages using npm install <package-name>
command
Step 3 Run the js file