move auth controller into it's own dir

This commit is contained in:
Martin McKeaveney 2021-04-08 11:57:23 +01:00
parent 4abe6192dc
commit 2077073986
4 changed files with 10 additions and 4 deletions

View File

@ -1,14 +1,11 @@
const Router = require("@koa/router")
const passport = require("@budibase/auth")
const controller = require("../../controllers/admin")
const authController = require("../../controllers/admin/auth")
const authenticated = require("../../../middleware/authenticated")
const router = Router()
router
.post("/api/admin/users", authenticated, controller.userSave)
.post("/api/admin/authenticate", authController.authenticate)
.delete("/api/admin/users/:email", authenticated, controller.userDelete)
.get("/api/admin/users", authenticated, controller.userFetch)
.get("/api/admin/users/:email", authenticated, controller.userFind)

View File

@ -0,0 +1,8 @@
const Router = require("@koa/router")
const authController = require("../controllers/auth")
const router = Router()
router.post("/api/auth/authenticate", authController.authenticate)
module.exports = router

View File

@ -1,4 +1,5 @@
const adminRoutes = require("./admin")
const authRoutes = require("./auth")
const appRoutes = require("./app")
exports.routes = [adminRoutes, appRoutes]
exports.routes = [adminRoutes, authRoutes, appRoutes]