D
D
Dima Pautov2017-07-04 12:39:18
MongoDB
Dima Pautov, 2017-07-04 12:39:18

How to run mongodb via npm?

Good afternoon! The question is, how is it right or easier to run mongodb locally?
I am training in writing API on a node. Every time I run the project, I constantly need to run mongodb manually in the console. Here is such a command:

"C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe"

Is there an easier way? What if, for example, I wrote the command:
npm run devand I still had the database running? Or some other way.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Ukolov, 2017-07-04
@alexey-m-ukolov

What if, for example, I wrote the command: npm run dev and I still had the database running?
Well, so do it .

D
Dark Hole, 2017-07-04
@abyrkov

package.json -> scripts

{
  "scripts": {
    "start": "mongod && node ."
  }
}

Like so

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question