summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/stress/identify.js2
-rw-r--r--scripts/stress/login.js17
2 files changed, 18 insertions, 1 deletions
diff --git a/scripts/stress/identify.js b/scripts/stress/identify.js
index 9c74c634..2a271bbc 100644
--- a/scripts/stress/identify.js
+++ b/scripts/stress/identify.js
@@ -3,7 +3,7 @@
 require("dotenv").config();
 const { OPCODES } = require("../../dist/gateway/util/Constants.js");
 const WebSocket = require("ws");
-const ENDPOINT = `ws://localhost:3002?v=9&encoding=json`;
+const ENDPOINT = `ws://localhost:3001?v=9&encoding=json`;
 const TOKEN = process.env.TOKEN;
 const TOTAL_ITERATIONS = process.env.ITER ? parseInt(process.env.ITER) : 500;
 
diff --git a/scripts/stress/login.js b/scripts/stress/login.js
new file mode 100644
index 00000000..473e2e95
--- /dev/null
+++ b/scripts/stress/login.js
@@ -0,0 +1,17 @@
+const fetch = require("node-fetch");
+const ENDPOINT = process.env.API || "http://localhost:3001";
+
+async function main() {
+	const ret = await fetch(`${ENDPOINT}/api/auth/login`, {
+		method: "POST",
+		body: JSON.stringify({
+			login: process.argv[2],
+			password: process.argv[3],
+		}),
+		headers: { "content-type": "application/json " },
+	});
+
+	console.log((await ret.json()).token);
+}
+
+main();