import { Hono } from "hono";
import { createUser, searchUser } from "./user.index";

const userRest = new Hono();

userRest.post('/', async (c) => {
  const user = await c.req.json();
  const result = await createUser(user);
  return c.json(result);
});

userRest.get('/search', async (c) => {
  const q = c.req.query('q') || '';
  const result = await searchUser(q);
  return c.json(result.hits.hits);
});
export default userRest;