mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-23 13:03:08 +00:00
✨ added defaults to config
This commit is contained in:
1 parent
7c9c9f2ff6
commit
2026ea5911
14 files changed
+124330
-97
No files matched your search
+9
-4
@@ -1,8 +1,13 @@
|
||||
import jwt from "jsonwebtoken";
|
||||
|
||||
// console.log(jwt.sign("test", "test"));
|
||||
const algorithm = "HS256";
|
||||
const iat = Math.floor(Date.now() / 1000);
|
||||
|
||||
jwt.verify(`${"2WmFS_EAdYFCBOFM9pVPo9g4bpuI2I9U_JGTCfrx7Tk".repeat(1000000)}`, "test", (err, decoded) => {
|
||||
if (err) console.error(err);
|
||||
console.log(decoded);
|
||||
// @ts-ignore
|
||||
const token = jwt.sign({ id: "311129357362135041" }, "secret", {
|
||||
algorithm,
|
||||
});
|
||||
console.log(token);
|
||||
|
||||
const decoded = jwt.verify(token, "secret", { algorithms: [algorithm] });
|
||||
console.log(decoded);
|
||||
@@ -1,7 +1,7 @@
|
||||
import mongoose from "mongoose";
|
||||
|
||||
async function main() {
|
||||
const mongoConnection = await mongoose.createConnection(
|
||||
const conn = await mongoose.createConnection(
|
||||
"mongodb://localhost:27017/lambert?readPreference=secondaryPreferred",
|
||||
{
|
||||
useNewUrlParser: true,
|
||||
@@ -9,6 +9,13 @@ async function main() {
|
||||
}
|
||||
);
|
||||
console.log("connected");
|
||||
const result = await conn
|
||||
.collection("users")
|
||||
.find({ $or: [{ email: "samuel.scheit@gmail.com" }, { phone: "samuel.scheit@gmail.com" }] })
|
||||
.toArray();
|
||||
// .project(undefined)
|
||||
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in new issue
Block a user