Closed psitronic closed 5 years ago
@psitronic sorry dude one last thing and I think we're good to go. linter objects to db definition in api.js:
/home/nik/projects/chingu/voyage7/bears17/server/routes/api.js
3:7 error 'db' is assigned a value but never used no-unused-vars
@psitronic sorry dude one last thing and I think we're good to go. linter objects to db definition in api.js:
/home/nik/projects/chingu/voyage7/bears17/server/routes/api.js 3:7 error 'db' is assigned a value but never used no-unused-vars
I need to execute the code in db.js in order to connect the DB. Of course it could be done in the api.js or even index.js file but I think it should be in the different file.
Now I moved the DB connection to index.js. It perhaps looks more logical.
@psitronic so sorry dude, messed you about a treat there, many apologies. I think it's a better idea to have the db conn in a different file, as you said. When I ran it locally, I just removed that db import in index.js and it still worked, hence my comment it could be removed. I didn't intend for 'everything' to be moved into index.js.
I think it's best to leave it as is for now and we can move it around if need be later.
A REST API to post/add question:
where Author is the ObjectID