http://localhost:3000/auth/login

------------------------------------------------------------

Quick HTTP tests:

 http://localhost:3001/users  in browser.

--------------------------------------------------------------

http://localhost:3001/users/create

http://localhost:3001/users
-------------------------------------------------------------

run command : npm run dev
-------------------------------------------------------------


Exiting project upload to github


git add .

git commit -m "Test Purpose"

git push

-------------------------------------------------------------

Once running, you can access your routes at:


GET    http://localhost:3000/users          # List all users
GET    http://localhost:3000/users/create   # Show create form
POST   http://localhost:3000/users          # Create new user
GET    http://localhost:3000/users/:id      # Show specific user
GET    http://localhost:3000/users/:id/edit # Show edit form
POST   http://localhost:3000/users/:id/update # Update user
POST   http://localhost:3000/users/:id/delete # Delete user
-----------------------------------------------------------------



---------------------------------------------------------------


1. app.ts : app.use('/users', userRoutes);                                            //1st start from here


2.  routes/user.routes.ts :  router.post('/', UserController.create);                  //2nd start from here


// Create user     //3rd start from here   


3.  controllers/UserController.ts    :    const user: IUser = {
                name: req.body.name,
                email: req.body.email
            };
         

                                     
  // Create user                 							//3rd start from here

    static async create(req: Request, res: Response) {
        try {
            const user: IUser = {
                name: req.body.name,
                email: req.body.email
            };
            await UserModel.create(user);
            res.redirect('/users');
        } catch (error) {
            res.status(500).render('error', { error: 'Failed to create user' });
        }
    }


4.   models/user.ts     	//Database						   //4th step Start from here

    
    static async create(user: IUser): Promise<number> {
        const [result] = await db.query(
            'INSERT INTO users (name, email) VALUES (?, ?)',
            [user.name, user.email]
        );
        return (result as any).insertId;
    }



------------------------------------------------------------------------------------------------------


This error indicates that port 3000 is already in use on your system, which is preventing your Node.js application from starting. This commonly happens when:

Another instance of your application is already running
A different application is using port 3000
A previous instance of your app crashed but didn't properly release the port

Here's how you can resolve this:
First, try to find and kill the process using port 3000:
On Windows (run in Command Prompt):
bashCopynetstat -ano | findstr :3000
This will show you the PID (Process ID) using port 3000. Then kill it:
bashCopytaskkill /PID <PID> /F


---------------------------------------------------------------------------------------------------------

Same Port Running Issue


 [nodemon] starting ts-node server.ts
Add command: ClientHandshake
Error: listen EADDRINUSE: address already in use :::3000
    at Server.setupListenHandle [as _listen2] (node:net:1912:16)
    at listenInCluster (node:net:1969:12)
    at Server.listen (node:net:2074:7)
    at Function.listen (D:\node_project\node_modules\express\lib\application.js:635:24)
    at Object.<anonymous> (D:\node_project\server.ts:20:5)
    at Module._compile (node:internal/modules/cjs/loader:1565:14)
    at Module.m._compile (D:\node_project\node_modules\ts-node\src\index.ts:1618:23)
    at node:internal/modules/cjs/loader:1708:10
    at Object.require.extensions.<computed> [as .ts] (D:\node_project\node_modules\ts-node\src\index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1318:32) {
  code: 'EADDRINUSE',
  errno: -4091,
  syscall: 'listen',
  address: '::',
  port: 3000
}
[nodemon] app crashed - waiting for file changes before starting...
[nodemon] restarting due to changes...
[nodemon] starting ts-node server.ts
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] starting ts-node server.ts
Add command: ClientHandshake
Error: listen EADDRINUSE: address already in use :::3000
    at Server.setupListenHandle [as _listen2] (node:net:1912:16)
    at listenInCluster (node:net:1969:12)
    at Server.listen (node:net:2074:7)
    at Function.listen (D:\node_project\node_modules\express\lib\application.js:635:24)
    at Object.<anonymous> (D:\node_project\server.ts:20:5)
    at Module._compile (node:internal/modules/cjs/loader:1565:14)
    at Module.m._compile (D:\node_project\node_modules\ts-node\src\index.ts:1618:23)
    at node:internal/modules/cjs/loader:1708:10
    at Object.require.extensions.<computed> [as .ts] (D:\node_project\node_modules\ts-node\src\index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1318:32) {
  code: 'EADDRINUSE',
  errno: -4091,
  syscall: 'listen',
  address: '::',
  port: 3000
}
[nodemon] app crashed - waiting for file changes before starting...



