Probably a very basic question, but I cannot seem to find a simple answer.
I have a GET method leveraging Angular\'s $http that is requesting a promise
HTTP GET method
Client:
$http.get('/login', {params: {name: 'ABCXYZ'}})
.success(
function(success){
console.log(success)
})
.error(
function(error){
console.log(error)
});
Server:
router.get('/login', function(req, res, next) {
var username = req.query.name;
res.json({'status': 200, 'msg': 'success'});
}
HTTP POST method
Client:
$http.post('/login', {params: {name: 'ABCXYZ'}})
.success(
function(success){
console.log(success)
})
.error(
function(error){
console.log(error)
});
Server:
router.post('/login', function(req, res, next) {
var username = req.body.params.name;
res.json({'status': 200, 'msg': 'success'});
}