home.ctrl.js
1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"use strict";
const User = require("../../models/User");
// const Restaurant = require("../../models/Restaurant");
const output = {
hello: (req, res) => {
res.render("home/index");
},
login: (req, res) => {
res.render("home/login");
},
register: (req, res) => {
res.render("home/register");
},
// restaurants: (req, res) => {
// res.render("home/restaurants");
// }
};
const process = {
login: async (req, res) => {
const user = new User(req.body);
const response = await user.login();
return res.json(response);
},
register: async (req, res) => {
const user = new User(req.body);
const response = await user.register();
// console.log(res.json(response));
// console.log(res.json(response).statusCode); => 이거도 잘 찍혔음.
return res.json(response);
},
// restaurants: async (req, res) => {
// const restaurant = new Restaurant(req.body);
// const response = await restaurant.restaurants();
// return res.json(response);
// },
};
module.exports = {
output,
process,
};