1.0.14 • Published 3 years ago
backend_fakes v1.0.14
backend_fakes
Instructions:
npm install backend_fakes
const backend_fakes = require('backend_fakes')
If utilizing in html...:
<script src="./node_modules/backend_fakes/index.js"></script>
<script>
$(()=> {
const output = backend_fakes.method(parameter)
})
</script>
Functions
passwordToHash(password) ⇒ string
passwordToHash
Kind: global function
Returns: string - hash
Date: 2022-03-11
Author: zen-out
Param | Type |
---|---|
password | any |
hashToPassword(password, hash) ⇒ boolean
Kind: global function
Date: 2022-03-11
Author: zen-out
Param | Type |
---|---|
password | string |
hash | string |
postDevice(filename, object) ⇒ any
- Get device
- If device exists
- Update the last login date
- Else, create new device
- Return device
Kind: global function
Date: 2022-03-16
Author: zen-out
Param | Type |
---|---|
filename | any |
object | any |
Example
userObject["user_id"] = postUser.id
userObject["device"] = req.device.parser.useragent.source;
userObject["type"] = req.device.type;
let getPost = await postDevice(filename, userObject)
signup(filename, userObject) ⇒ any
Kind: global function
Date: 2022-03-20
Author: zen-out
Param | Type |
---|---|
filename | any |
userObject | any |
Example
/**
Example
let sampleObject = {
email: "asdfasdf213@gmdail.com",
password: "asdfasdf",
type: "chrome",
device: "desktop"
}
let sampleObject2 = {
email: "lesle3yc2@gmail.com",
password: "orangeorange"
}
// let firstSignup = await signup(filename, sampleObject)
// see.done("signup", firstSignup)
let firstLogin = await login(filename, sampleObject)
see.done("login", firstLogin)
let verify = await verifyUserRoute(filename, 48, 14)
see.done("verify route" + verify)
login(filename, userObject) ⇒ any
Kind: global function
Date: 2022-03-20
Author: zen-out
Param | Type |
---|---|
filename | any |
userObject | any |
Example
let sampleObject = {
email: "asdfasdf213@gmdail.com",
password: "asdfasdf",
type: "chrome",
device: "desktop"
}
let sampleObject2 = {
email: "lesle3yc2@gmail.com",
password: "orangeorange"
}
// let firstSignup = await signup(filename, sampleObject)
// see.done("signup", firstSignup)
let firstLogin = await login(filename, sampleObject)
see.done("login", firstLogin)
let verify = await verifyUserRoute(filename, 48, 14)
see.done("verify route" + verify)
verifyUserRoute(req, res, next) ⇒ boolean
- Checks if user is logged in
- Checks if the last logged in date is within 14 days
Kind: global function
Date: 2022-03-16
Author: zen-out
Param | Type |
---|---|
req | any |
res | any |
next | any |
Example
// let verify = await verifyUserRoute(sampleRequest, filename)
logout(filename, number) ⇒ boolean
Kind: global function
Date: 2022-03-20
Author: zen-out
Param | Type |
---|---|
filename | any |
number | any |
Example
// let test_logout = await logout(filename, 48)
mostRecentlyCreatedProblems(filename, user_id) ⇒ any
mostRecentlyCreatedProblems(filename, user_id)
Kind: global function
Date: 2022-03-22
Author: zen-out
Param | Type |
---|---|
filename | any |
user_id | any |
mostRecentProblems()
Kind: global function
Author: github.com/zen-out
Example
await mostRecentProblems(filename, user_id)