I have a user controller method like:
create: function( req, res ){
res.json({name:"Cool Name"});
}
But when use this
socket.post("/user/create", {
myName: "John Doe"}, function(r){ console.log(r) });
I get an error message "Forbidden" with status code 500. Its working fine when I make normal post request. Can you please throw some light on this.
You are posting to /user/create, which is the "shortcut" create URL. Shortcuts are accessed with the GET method (and should generally be turned off in production). To create a user via POST, use the /user URL:
socket.post("/user", {myName: "John Doe"}, function(r){ console.log(r) });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With