const express = require("express") const authService = require("../../../../services/authService") const router = express.Router() router.post("/", authService.isNotLogged, async (req, res) => { if (process.env.REGISTER_ENABLED != "true") { return res.status(401).json({ error: "registration_disabled", error_description: "The administrator has disabled internal registration." }) } const { identifier, password, avatarURL, displayName } = req.body const user = await authService.registerLocal({ identifier, password, profile: { avatarURL, displayName } }) return res.status(201).json(user) }) module.exports = router