2.0 KiB
2.0 KiB
Project Rules
Shell & Process Rules
- NEVER run
cmd /corcmd.exedirectly. UseInvoke-WebRequest,Invoke-RestMethod,Start-Process, or directnodecommands via PowerShell instead. - NEVER run long-running processes (e.g.
node server.js) in the foreground. Always useStart-Process -NoNewWindowwithout-Waitto background them. - NEVER run long-running processes (e.g.
node server.js) in the foreground. Always useStart-Process -NoNewWindowwithout-Waitto background them. - Prefer
Invoke-WebRequest/Invoke-RestMethodovercurl.exefor HTTP testing. - When backgrounding a server process, redirect stdout/stderr to log files:
-RedirectStandardOutput "out.log" -RedirectStandardError "err.log".
Project Context
This is a Game Player Complaint/Suggestion/Appeal System (MC Report System) built with:
- Backend: Node.js + Express + MySQL (mysql2)
- Frontend: Vanilla JS SPA with hash-based routing
- Auth: JWT with role-based access (owner/admin/player)
Key Files
backend/db.js— MySQL connection pool + schema init + config persistencebackend/server.js— Express entry point, checks install status, conditional route loadingbackend/routes/tickets.js— Core ticket logic (report/suggestion/appeal)backend/routes/install.js— Installation wizard APIpublic/js/app.js— Frontend routerdata/config.json— MySQL connection config (created during install)
Installation Flow
- Start server:
node backend/server.js - Visit
http://localhost:3100/#/install - Step 1: Enter MySQL credentials, test connection
- Step 2: Create owner account
- Restart server to load business routes
After making backend changes
- Stop existing server:
Get-Process -Name "node" -ErrorAction SilentlyContinue | Stop-Process -Force - Restart:
Start-Process -FilePath "node" -ArgumentList "backend\server.js" -WorkingDirectory "C:\Users\canglan\Documents\Web\mc-report" -NoNewWindow -RedirectStandardOutput "o.log" -RedirectStandardError "e.log"