globalRouter.js 1.05 KB
Newer Older
KangMin An's avatar
KangMin An committed
1
2
import express from "express";
import routes from "../routes";
3
import { getHome } from "../controllers/globalController";
4
import {
5
  getConfirm,
6
  getEditProfile,
7
8
  getLogin,
  getSignup,
9
10
  getUserInfo,
  postEditProfile,
11
  postLogin,
12
  getLogout,
13
  postSignup,
14
  getToggleAircon,
15
} from "../controllers/userController";
KangMin An's avatar
KangMin An committed
16
import { onlyPrivate } from "../middlewares";
KangMin An's avatar
KangMin An committed
17
18
19

const globalRouter = express.Router();

20
21
22
23
// For development test.
globalRouter.get("/", getHome);
globalRouter.get(routes.signup, getSignup);
globalRouter.get(routes.login, getLogin);
24
globalRouter.get(routes.editProfile, onlyPrivate, getEditProfile);
KangMin An's avatar
KangMin An committed
25

26
27
28
// Authentication
globalRouter.post(routes.signup, postSignup);
globalRouter.post(routes.login, postLogin);
29
globalRouter.get(routes.logout, onlyPrivate, getLogout);
30
globalRouter.get(routes.confirm, getConfirm);
31
32
33
34

// User Info
globalRouter.get(routes.userinfo, onlyPrivate, getUserInfo);
globalRouter.post(routes.editProfile, onlyPrivate, postEditProfile);
35
globalRouter.get(routes.toggleAircon, onlyPrivate, getToggleAircon);
36

KangMin An's avatar
KangMin An committed
37
export default globalRouter;