feat: register route

This commit is contained in:
karishmas6
2024-09-23 23:57:12 +05:30
parent 29f92cd094
commit ca175fdcae

View File

@@ -1,9 +1,11 @@
import { Router } from 'express';
import { hashPassword, comparePassword } from '../utils/auth';
import bcrypt from 'bcrypt';
import jwt from 'jsonwebtoken';
// Todo: DB
export const router = Router();
const register = async (req, res) => {
router.post('/register', async (req, res) => {
try {
const { email, password } = req.body
@@ -34,7 +36,7 @@ const register = async (req, res) => {
} catch (error) {
res.status(500).send(`Could not register user - ${error.message}`)
}
}
})
const login = async (req, res) => {
try {