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

const globalRouter = express.Router();

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

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

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

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