hello,To read my current users I import a json file to my auth javascriptconst json= require("../users.json) const users = json.usersHowever, I have to restart my server every time when a new user is added. I'm using lowdb to write to files and for some reason when a new users is posted to users.json it won't appear when I read it in my auth code.In case that it might have to do with how I write users, here is my post request to writing users to users.jsonconst UsersAdapter = new FileAsync('users.json')low(UsersAdapter) .then(db => {app.post('/new/users', (req, res) => { db.get('users').push(req.body).last().write().then(user =>res.send(user), req.body); })}); Thanks in advance!!!
Submitted June 15, 2020 at 07:10PM by LGm17
No comments:
Post a Comment