summary refs log tree commit diff
path: root/src/api/routes/auth
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-05-29 06:17:12 +0200
committerRory& <root@rory.gay>2025-05-29 06:17:12 +0200
commit5ab3cbaa54642ada07085d1e0aa2e984dec1849a (patch)
tree51b7cc22c9db8b0fb290bf6dc1e27d7a695039d5 /src/api/routes/auth
parentMove middlewares out of start.js (diff)
downloadnodejs-final-assignment-5ab3cbaa54642ada07085d1e0aa2e984dec1849a.tar.xz
Allow unfree in nix flake, add mongodb-compass to devShell closure, basic mongo attempt, add test register route
Diffstat (limited to 'src/api/routes/auth')
-rw-r--r--src/api/routes/auth/index.js1
-rw-r--r--src/api/routes/auth/registerRoute.js14
2 files changed, 15 insertions, 0 deletions
diff --git a/src/api/routes/auth/index.js b/src/api/routes/auth/index.js
new file mode 100644

index 0000000..8306697 --- /dev/null +++ b/src/api/routes/auth/index.js
@@ -0,0 +1 @@ +export * from "./registerRoute.js"; diff --git a/src/api/routes/auth/registerRoute.js b/src/api/routes/auth/registerRoute.js new file mode 100644
index 0000000..b71c466 --- /dev/null +++ b/src/api/routes/auth/registerRoute.js
@@ -0,0 +1,14 @@ +import { User } from "#db/schemas/userSchema.js"; + +export const registerRoute = { + route: "/auth/register", + async onGet(req, res) { + const result = await User.create({ + username: req.query.username, + password: req.query.password, + email: req.query.email, + }); + + res.send(result); + }, +};