generated from azures04/Base-REST-API
Initial commit
This commit is contained in:
19
services/register.js
Normal file
19
services/register.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const crypto = require("node:crypto")
|
||||
const DefaultError = require("../errors/DefaultError")
|
||||
|
||||
function register({ email, username }) {
|
||||
const canRegister = true
|
||||
if (canRegister === true) {
|
||||
return {
|
||||
id: crypto.randomUUID(),
|
||||
username: username,
|
||||
email: email
|
||||
}
|
||||
} else {
|
||||
throw new DefaultError(418, "I'm a teapot", "", "TeaPotExeception")
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register
|
||||
}
|
||||
Reference in New Issue
Block a user