surfagent 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/server.js +8 -0
- package/package.json +1 -1
- package/src/api/server.ts +9 -0
package/dist/api/server.js
CHANGED
|
@@ -179,6 +179,14 @@ const server = http.createServer(async (req, res) => {
|
|
|
179
179
|
json(res, 500, { error: message });
|
|
180
180
|
}
|
|
181
181
|
});
|
|
182
|
+
server.on('error', (err) => {
|
|
183
|
+
if (err.code === 'EADDRINUSE') {
|
|
184
|
+
console.error(`[surfagent] Port ${PORT} is already in use. API may already be running.`);
|
|
185
|
+
console.error(`[surfagent] Check with: curl localhost:${PORT}/health`);
|
|
186
|
+
process.exit(1);
|
|
187
|
+
}
|
|
188
|
+
throw err;
|
|
189
|
+
});
|
|
182
190
|
server.listen(PORT, () => {
|
|
183
191
|
console.log(`Browser Recon API running on http://localhost:${PORT}`);
|
|
184
192
|
console.log(`CDP target: ${CDP_HOST}:${CDP_PORT}`);
|
package/package.json
CHANGED
package/src/api/server.ts
CHANGED
|
@@ -207,6 +207,15 @@ const server = http.createServer(async (req, res) => {
|
|
|
207
207
|
}
|
|
208
208
|
});
|
|
209
209
|
|
|
210
|
+
server.on('error', (err: NodeJS.ErrnoException) => {
|
|
211
|
+
if (err.code === 'EADDRINUSE') {
|
|
212
|
+
console.error(`[surfagent] Port ${PORT} is already in use. API may already be running.`);
|
|
213
|
+
console.error(`[surfagent] Check with: curl localhost:${PORT}/health`);
|
|
214
|
+
process.exit(1);
|
|
215
|
+
}
|
|
216
|
+
throw err;
|
|
217
|
+
});
|
|
218
|
+
|
|
210
219
|
server.listen(PORT, () => {
|
|
211
220
|
console.log(`Browser Recon API running on http://localhost:${PORT}`);
|
|
212
221
|
console.log(`CDP target: ${CDP_HOST}:${CDP_PORT}`);
|