Skip to content

add npm script format #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"start": "nodemon --exec babel-node src/index.js",
"test:run-server": "TEST_DATABASE_URL=mongodb://localhost:27017/mytestdatabase npm start",
"test:execute-test": "TEST_DATABASE_URL=mongodb://localhost:27017/mytestdatabase mocha --require @babel/register 'src/**/*.spec.js'",
"test": "echo \"No test specified\" && exit 0"
"test": "echo \"No test specified\" && exit 0",
"format": "npx prettier --config .prettierrc --write 'src/**/*.js'"
},
"keywords": [],
"author": "Robin Wieruch <hello@rwieruch.com> (https://www.robinwieruch.de)",
Expand Down
14 changes: 6 additions & 8 deletions src/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ import Message from './message';

const connectDb = () => {
if (process.env.TEST_DATABASE_URL) {
return mongoose.connect(
process.env.TEST_DATABASE_URL,
{ useNewUrlParser: true },
);
return mongoose.connect(process.env.TEST_DATABASE_URL, {
useNewUrlParser: true,
});
}

if (process.env.DATABASE_URL) {
return mongoose.connect(
process.env.DATABASE_URL,
{ useNewUrlParser: true },
);
return mongoose.connect(process.env.DATABASE_URL, {
useNewUrlParser: true,
});
}
};

Expand Down