I am coding a react native app and have a query that contains two parameters in the WHERE statement. The problem is, I don't know how to route it properly. I already tried routing with one parameter, and it works. But, when I try using two parameters, it can't actually get any data from the database.
Here are my codes:
Routing:
router.route('/users/user=:username').get((request,response) => {
operations.getUsers(request.params.username).then(result => {
response.json(result[0])
})
})
Query:
let pool = await sql.connect(config);
let users = await pool.request()
.input('username', sql.VarChar, user)
.input('password', sql.Char, pass)
.query('SELECT * FROM Users_temp WHERE username = @username');
return users.recordsets;