Is there any way to accept POST type requests without using Nerve lib in Node.js?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
By default the http.Server class of Node.js accepts any http method.
You can get the method using
request.method(api link).Example:
This will create a simple http server on the port 8000 that will echo the method used in the request.
If you want to get a POST you should just check the
request.methodfor the string “POST”.Update regarding
response.end:Since version 0.1.90, the function to close the response is
response.endinstead ofresponse.close. Besides the name change,endcan also send data and close the response after this data is sent unlike close. (api example)