FACK1 / week8---SAAO

Week 8 - Express app.
1 stars 1 forks source link

Handeling two running cases in db_build.js #33

Closed ghassanmas closed 5 years ago

ghassanmas commented 5 years ago

https://github.com/FACK1/week8---SAAO/blob/b4add2e4deb6c93eda20b56461470e466d444fba/src/database/db_build.js#L17-L20

In order to handle the two cases of running db_build.js where once you need to export it in case of NODE_ENV==TEST, or to run it otherwise...

if (process.env.NODE_ENV === "TEST") {
  module.exports = buildDB;
} else {
  buildDB();
}
amanshawar commented 5 years ago

done