From 56072ff282cb5a34908dccbab56cfc08682052b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Thu, 25 Mar 2021 20:48:00 +0100 Subject: [PATCH] feat: Allow register locally without authentication --- api/router.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/api/router.js b/api/router.js index a9cac58..a60d566 100644 --- a/api/router.js +++ b/api/router.js @@ -87,8 +87,15 @@ router.get("/chat/history", chatController.getAllHistory); router.delete("/chat/history", mustBeAuthenticated, chatController.deleteHistory); router.post("/login", userController.login); -router.post("/register", mustBeAuthenticated, userController.register); + router.get("/logout", userController.logout); +if(process.env !== "production") { + // We don't want to hide registering behind a + // authentication-wall if we are in dev + router.post("/register", userController.register); +} else { + router.post("/register", mustBeAuthenticated, userController.register); +} // router.get("/", documentation.apiInfo);