Преглед изворни кода

define POST register routes in apiv3 using middlewares

yohei0125 пре 3 година
родитељ
комит
ef6c54ae07
1 измењених фајлова са 7 додато и 2 уклоњено
  1. 7 2
      packages/app/src/server/routes/apiv3/index.js

+ 7 - 2
packages/app/src/server/routes/apiv3/index.js

@@ -13,7 +13,7 @@ const router = express.Router();
 const routerForAdmin = express.Router();
 const routerForAuth = express.Router();
 
-module.exports = (crowi) => {
+module.exports = (crowi, middlewaresForAuth) => {
 
   // add custom functions to express response
   require('./response')(express, crowi);
@@ -38,8 +38,13 @@ module.exports = (crowi) => {
   routerForAdmin.use('/activity', require('./activity')(crowi));
 
   // auth
-  routerForAuth.use('/logout', require('./logout')(crowi));
+  const {
+    applicationInstalled, registerFormValidator, csrfProtection, addActivity, login,
+  } = middlewaresForAuth;
 
+  routerForAuth.use('/logout', require('./logout')(crowi));
+  routerForAuth.post('/register', applicationInstalled, registerFormValidator.registerRules(), registerFormValidator.registerValidation,
+    csrfProtection, addActivity, login.register);
 
   router.use('/in-app-notification', require('./in-app-notification')(crowi));