Make sure package.json includes these dependencies: '''json { "name": "breach-lookup-service", "version": "1.0.0", "type": "module", "scripts": { "start": "node server.js" }, "dependencies": { "express": "^4.18.2", "dotenv": "^16.0.0", "nodemailer": "^6.9.1", "jsonwebtoken": "^9.0.0" } } '''
If you don’t already have these, you can add them in one go: npm install express dotenv nodemailer jsonwebtoken
'''dotenv
EMAIL_HASH_KEY=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
JWT_SECRET=your_jwt_secret_here
CODE_TTL=600
INPUT_DIR=/mnt/Torrents/WDHome/breaches
SHARD_DIR=/mnt/Torrents/WDHome/data/shards
SMTP_HOST=smtp.example.com SMTP_PORT=587 SMTP_USER=username SMTP_PASS=password SMTP_FROM="no-reply@yourdomain.com"
'''
Be sure to replace EMAIL_HASH_KEY and JWT_SECRET with your own securely generated random values.
npm install
npm start
-
Request a code curl -X POST http://localhost:3000/api/request-code
-H 'Content-Type: application/json'
-d '{"email":"you@example.com"}' -
Verify & get JWT curl -X POST http://localhost:3000/api/verify-code
-H 'Content-Type: application/json'
-d '{"email":"you@example.com","code":"123456"}' -
Lookup breaches curl http://localhost:3000/api/breaches
-H "Authorization: Bearer eyJ…"
pm2 logs breach-lookup OR just the error stream: tail -f ~/.pm2/logs/breach-lookup-error.log
-
Install PM2 globally: sudo npm install -g pm2 pm2 start ecosystem.config.cjs --only breach-lookup pm2 save pm2 startup
-
Check status: pm2 list pm2 logs breach-lookup
-
Restart
-
To stop the lookup service pm2 stop breach-lookup
-
To start it again pm2 start breach-lookup
-
Or to restart in one go pm2 restart breach-lookup
-
You can do the same my which is shown in pm2 list: pm2 stop pm2 start