mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-09 20:22:47 +01:00
add login script
This commit is contained in:
parent
3d0fdc8a1b
commit
db777541cc
@ -3,7 +3,7 @@
|
|||||||
require("dotenv").config();
|
require("dotenv").config();
|
||||||
const { OPCODES } = require("../../dist/gateway/util/Constants.js");
|
const { OPCODES } = require("../../dist/gateway/util/Constants.js");
|
||||||
const WebSocket = require("ws");
|
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 TOKEN = process.env.TOKEN;
|
||||||
const TOTAL_ITERATIONS = process.env.ITER ? parseInt(process.env.ITER) : 500;
|
const TOTAL_ITERATIONS = process.env.ITER ? parseInt(process.env.ITER) : 500;
|
||||||
|
|
||||||
|
17
scripts/stress/login.js
Normal file
17
scripts/stress/login.js
Normal 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();
|
Loading…
Reference in New Issue
Block a user