globalRouter.js 997 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
  getLogin,
KangMin An's avatar
KangMin An committed
7
  getSetLoccode,
8
  getSignup,
9
10
  getUserInfo,
  postEditProfile,
11
  postLogin,
KangMin An's avatar
KangMin An committed
12
  postSetLoccode,
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
23
// For development test.
globalRouter.get("/", getHome);
globalRouter.get(routes.signup, getSignup);
globalRouter.get(routes.login, getLogin);
globalRouter.get(routes.setLoccode, onlyPrivate, getSetLoccode);
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.confirm, getConfirm);
29
30
31
32

// User Info
globalRouter.get(routes.userinfo, onlyPrivate, getUserInfo);
globalRouter.post(routes.editProfile, onlyPrivate, postEditProfile);
KangMin An's avatar
KangMin An committed
33
globalRouter.post(routes.setLoccode, onlyPrivate, postSetLoccode);
34

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