const express = require('express');
const { getConnection, searchUser } = require('../libs/mysql');

const router = express.Router();

router.get('/', async (req, res) => {
    const { search } = req.query;
    const connection = await getConnection();
    const users = await searchUser(connection, search);
    connection.end();
    res.send(users);
});

module.exports = router;