User:  
1  this is login api 

				Code : const bcrypt = require('bcrypt');
const User = require('../models/User');

const loginUser = async (req, res) => {
    const {
        username,
        email,
        password
    } = req.body;

    // Validate input
    if (!email || !username || !password) {
        return res.status(400).json({
            message: 'All fields are required'
        });
    }

    const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
    if (!emailRegex.test(email)) {
        return res.status(400).json({
            message: 'Invalid email format'
        });
    }

    // Check password strength (simple example, expand as needed)
    if (password.length < 6) {
        return res.status(400).json({
            message: 'Password must be at least 6 characters long'
        });
    }

    // Check for existing username or email
    const existingUser = await User.findOne({
        $or: [{
            username
        }, {
            email
        }]
    });
    if (existingUser) {
        return res.status(400).json({
            message: 'Username or email already exists'
        });
    }

    // Hash the password
    const hashedPassword = await bcrypt.hash(password, 10);

    // Save user data
    const newUser = new User({
        username,
        email,
        password: hashedPassword
    });
    await newUser.save();

    return res.status(201).json({
        message: 'User created successfully'
    });
};


module.exports = {
    loginUser
}
User:  
2  this is register api 

				Code : const express = require('express');
const bcrypt = require('bcrypt');
const User = require('./models/User'); // Import the User model
const router = express.Router();

// User registration endpoint
const userRegisger = async (req, res) => {
    const {
        username,
        email,
        password
    } = req.body;

    // Validate input data
    if (!username || !email || !password) {
        return res.status(400).json({
            message: 'All fields are required.'
        });
    }

    try {
        // Check for duplicate usernames
        const existingUser = await User.findOne({
            username
        });
        if (existingUser) {
            return res.status(400).json({
                message: 'Username already exists.'
            });
        }

        // Hash the password
        const hashedPassword = await bcrypt.hash(password, 10);

        // Create a new user
        const newUser = new User({
            username,
            email,
            password: hashedPassword
        });

        // Save user to the database
        await newUser.save();

        return res.status(201).json({
            message: 'User registered successfully.'
        });
    } catch (error) {
        console.error(error);
        return res.status(500).json({
            message: 'Server error.'
        });
    }
}


module.exports = {
    loginUser,
    userRegisger
}
User: 

		 {description:Create a router for task controller., 
Ensure all necessary API endpoints are defined., 
Add router parameters where needed., 
Set isImport to true., 
Read reference tasks and create routes using api name., 
Import the controller from ../controller/userController.  }
	
		 Analyse above object generate source code for description and send response as only a json_object
		 {
  "name": "prompt_name",
  "schema": {
    "type": "string",
	"code":"genarted code"
	"require":"extracted external modules or libraries like const bcrypt = require('bcrypt');"
	}
	}
		
Assistant: