1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-09 12:12:35 +01:00

add login script

This commit is contained in:
Madeline 2023-08-07 16:46:40 +10:00
parent 3d0fdc8a1b
commit db777541cc
No known key found for this signature in database
GPG Key ID: 80D25DA3BCB24281
2 changed files with 18 additions and 1 deletions

View File

@ -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;

17
scripts/stress/login.js Normal file
View File

@ -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();