user.controller.ts 409 Bytes
Newer Older
Yoon, Daeki's avatar
Yoon, Daeki committed
1
2
3
4
5
6
7
8
9
10
11
12
import { userDb } from "../db";
import { asyncWrap } from "../helpers/asyncWrap";

export const getUsers = asyncWrap(async (req, res) => {
  const users = await userDb.getUsers();
  return res.json(users);
});

export const createUser = asyncWrap(async (req, res) => {
  const user = req.body;
  console.log("user body", user);
  const newUser = await userDb.createUser(user);
13
  return res.json(newUser);
Yoon, Daeki's avatar
Yoon, Daeki committed
14
});