globalRouter.js 985 Bytes
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
14
  postSignup,
} from "../controllers/userController";
KangMin An's avatar
KangMin An committed
15
import { onlyPrivate } from "../middlewares";
KangMin An's avatar
KangMin An committed
16
17
18

const globalRouter = express.Router();

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

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

// User Info
globalRouter.get(routes.userinfo, onlyPrivate, getUserInfo);
globalRouter.post(routes.editProfile, onlyPrivate, postEditProfile);
34

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