user.controller.js 563 Bytes
Newer Older
Kim, Subin's avatar
Kim, Subin committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import User from "../models/User.js";

const signup = async (req, res) => {
    const { name, email, password } = req.body
    try {
        const newUser = await new User ({
            name,
            email,
            password
        }).save()
        console.log(newUser)
        res.json(newUser)
        
    } catch (error) {
        console.log(error)
        res.status(500).send('죄송합니다. 다시 입력해 주십시오.')
    }
}

const hello = (req, res) => {
    res.send('Hello from users contriller')
}

export default  { signup, hello }