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


<form ng-submit='adminPermission(secret_key)'>
            <div class="login-form-username-container">
                <div class="login-form-username-text">Please see owner for key</div>              
                <input id="username-input" class="form-control" type="text" ng-model="secret_key" placeholder="Secret Key" required>
            <div class="check-submit-login">
                <button id="button-text" type="submit"><strong>Check</strong></button>
            <div class="back-button-admin" ui-sref="login">Or go back</div>


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


this.adminPermission = (secret_key) => {
    return $http({
        method: 'POST',
        url: '/admin-permission/' + secret_key,
    }).then((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'/admin-permission/:secret_key', trainerCtrl.adminPermission);


  adminPermission: (req, res) => {
    app.get('db').get_secret_key([]).then(response => {
      const user = response;
    }).catch(err => console.log(err))


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