Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Insert user
- router.post('/', async function(request, response) {
- let object = {
- name: request.body.userName,
- password: request.body.userPassword
- }
- let insert = await serviceUser.insert(object);
- console.log(insert); //Aqui mostra todos os dados (id inserido, número de inserts, etc)
- response.send(insert);
- });
- $http({
- method: method,
- url: 'http://localhost:3000/user',
- data: {userName: 'teste', userPassword: '123abc'},
- mode: 'no-cors'
- })
- .then(function(response) {
- $scope.dataResponse = response;
- console.log(response); //Aqui aparece o header, status, ... e o atributo data (que contém o retorno do servivor) apenas com: { n: 1, ok: 1 }
- })
- .catch(error => console.log(error));
Add Comment
Please, Sign In to add comment