chingu-voyage7 / Bears-Team-17

CarTalk - A community designed for car enthusiasts | Voyage-7 | https://chingu.io/
5 stars 0 forks source link

Feature add api post question #13

Closed psitronic closed 5 years ago

psitronic commented 5 years ago

A REST API to post/add question:

where Author is the ObjectID

nikrb commented 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 commented 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

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.

psitronic commented 5 years ago

Now I moved the DB connection to index.js. It perhaps looks more logical.

nikrb commented 5 years ago

@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.