readfile async is causing lots of problems

This commit is contained in:
Will Bradley 2018-09-01 17:11:01 -07:00
parent ad1d060cdc
commit 5d263d070d
No known key found for this signature in database
GPG Key ID: 42BAE225DDDB7093

View File

@ -6,10 +6,9 @@ const CARDS_PATH = path.join(process.cwd(), 'cards.json')
module.exports = class Cards {
static all() {
return new Promise((resolve, reject) => {
fs.readFile(CARDS_PATH, (err, data) => {
if (err) return reject(err)
resolve(JSON.parse(data))
})
var cards = fs.readFileSync(CARDS_PATH, "utf8")
var out = JSON.parse(cards)
resolve(out)
})
}