the connection between route folder and public in nodejs and hbs

i am trying to get data from MYSQL table and i am using nodejs hbs in my routes/index.js i wrote:

routes.get('/users', (req, res) => {
  const query = 'SELECT * FROM users';
  connection.query(query, (error, results) => {
    if (error) {
      res.status(500).send(error);
    } else {
      res.send(results);
    }
  });
});

and in my public/javascript i am suppose to fetch date and use it with other function

$.ajax({
    url: '/users',
    method: 'GET',
    success: function(data) {
      // handle success
      console.log(results);
    },
    error: function(error) {
      // handle error
      console.log(error);
    }
  });

however i always get this error:

https://mywebsite/users 404 (Not Found)