# How to verify a forms input value to see if it exists in database

I am pretty new to coding and I am building an application using angularJS, NodeJS, and ExpressJS. I have run into a problem trying to verify if a value on an input is found in the database and if it is, allows access to a new view.

I can get my value to the service where I can see the value when console logged but I am lost after that.

I am trying to learn about verification which is why I am doing this.
Any help would be appreciated

Here is my code

HTML

<form ng-submit='adminPermission(secret_key)'>
<input id="username-input" class="form-control" type="text" ng-model="secret_key" placeholder="Secret Key" required>
</div>
<button id="button-text" type="submit"><strong>Check</strong></button>
</div>
</form>


Controller

  $scope.adminPermission = function (secret_key) { adminService.adminPermission(secret_key) .then(function (response) { if (!response.data) { console.warn("Unable to get creds"); } else{$state.go('newadmin');
}
});
};


Service

this.adminPermission = (secret_key) => {
console.log(secret_key);
return $http({ method: 'POST', url: '/admin-permission/' + secret_key, }).then((response) => { console.log(response); return response; }); };  This is where I am lost. I got the endpoint set up in the IndexJS but I am lost on how to set up the logic in the TrainerCtrl to check for verification IndexJS app.post('/admin-permission/:secret_key', trainerCtrl.adminPermission);  TrainerCtrl  adminPermission: (req, res) => { app.get('db').get_secret_key([]).then(response => { const user = response; console.log("success") res.status(200).send(response) }).catch(err => console.log(err)) },  SQL select * from secret_key where secret_key =$1;


How do I verify if the value sent by the form called secret_key matches the value in the database?

Source: AngularJS