0

I am working on a node.js app and I am using nodemon to run the script, which starts the server. My package.json file begins with something like this:

{
  "name": "file-converter-server",
  "version": "1.0.0",
  "description": "A file format converter app",
  "main": "src/config/server.js",
  "scripts": {
    "start": "nodemon src/config/server.js",
    "test" : "echo \"Error: no test specified\" && exit 1"
  }

My question is, is there a way apart from starting the server.js script to also call a script which would generate a database (lets say that it is called files.sql)? I wish to do sth like:

"start": "nodemon src/config/server.js" && "files.sql"

Does anyone know if this is possible and how I could proceed with it? I appreciate any help

1 Answer 1

0

What do you mean by generate a database? Generate tables with columns ?

Sign up to request clarification or add additional context in comments.

2 Comments

yeah. I mean having an sql script which has code like "CREATE DATABASE.." and let this script run from nodemos when the app starts
but for it you don't need bash script) Just create one sql file save it in you server. Then you can import it in docker for example github.com/bin-umar/TechnoparkDB/blob/master/Dockerfile#L25 or this answer maybe useful too stackoverflow.com/questions/22276763/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.