You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
export class Db {
private db
constructor(db:any) {
this.db = db
}
protected findOne(query):Promise {
return new Promise(async (res, rej) => {
this.db.findOne(query, (err, doc) => {
if (err) {
rej({ error: err })
} else {
if (!!doc) {
doc.id = doc._id
res(doc)
} else {
rej({ error: 'NOT_FOUND' })
}
}
})
})
}
}
user.ts
import { UserFactory } from '../../factory/user/user.entity'
import { Db } from '../db/db'
export class User extends Db {
constructor(db:any) {
super(db)
}
findByEmailAndPasswod(email:string, password:string):Promise {
return super.findOne({ email, password })
}
}
database.ts
import { User } from './user/user'
const Datastore = require('nedb')
require('dotenv').load()
let db = new Datastore({ filename: `database/datastore/data.${process.env.target}.db`, autoload: true })
let a:any = {}
export const DataBase = {
user: new User(db)
}
login.ts (I have other files equal to this)
import { AuthAssets } from './assets'
import { generateToken } from '../utils/jwt'
import { DataBase } from '../../database/database'
module.exports = {
path: `/auth/login`,
method: 'POST',
render: async (req:any, res:any) => {
const { email, password } = req.body
try {
let user = await DataBase.user.findByEmailAndPasswod(email, password)
res.status(200).send({ user: user })
} catch(e) {
if (e.error === 'NOT_FOUND') res.status(401).send(e)
else res.status(500).send(e)
}
}
}
When I try to run the Dyzon I get a "Maximum call stack size exceeded "
command: "node dyson.js"
Error:
RangeError: Maximum call stack size exceeded
at findRecursive (/home/ivan/repositories/luva_acessoria/frontend/node_modules/dyson/lib/loader.js:12:23)
at findRecursive (/home/ivan/repositories/luva_acessoria/frontend/node_modules/dyson/lib/loader.js:23:22)
at findRecursive (/home/ivan/repositories/luva_acessoria/frontend/node_modules/dyson/lib/loader.js:23:22)
at findRecursive (/home/ivan/repositories/luva_acessoria/frontend/node_modules/dyson/lib/loader.js:23:22)
at findRecursive (/home/ivan/repositories/luva_acessoria/frontend/node_modules/dyson/lib/loader.js:23:22)
at findRecursive (/home/ivan/repositories/luva_acessoria/frontend/node_modules/dyson/lib/loader.js:23:22)
at findRecursive (/home/ivan/repositories/luva_acessoria/frontend/node_modules/dyson/lib/loader.js:23:22)
at findRecursive (/home/ivan/repositories/luva_acessoria/frontend/node_modules/dyson/lib/loader.js:23:22)
at findRecursive (/home/ivan/repositories/luva_acessoria/frontend/node_modules/dyson/lib/loader.js:23:22)
at findRecursive (/home/ivan/repositories/luva_acessoria/frontend/node_modules/dyson/lib/loader.js:23:22)
I managed to solve, when the typescript compiled my files it generated a folder "mock", so far so good, because that was how it was configured my "tsconfig.json". The problem was that inside the folder "mock" it created another folder "mock" ai the script of the dyson entered in a recursion
I have the following structure
user.ts
database.ts
login.ts (I have other files equal to this)
dyson.js
When I try to run the Dyzon I get a "Maximum call stack size exceeded "
command: "node dyson.js"
Error:
The text was updated successfully, but these errors were encountered: