简体   繁体   English

如何使用 nodemon 在 Node.js 上自动创建 mysql 数据库?

[英]How to automate mysql database creation on Node.js with nodemon?

I am working on a node.js app and I am using nodemon to run the script, which starts the server.我正在开发一个 node.js 应用程序,我正在使用 nodemon 运行脚本,该脚本启动服务器。 My package.json file begins with something like this:我的package.json文件开头是这样的:

{
  "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 )?我的问题是,除了启动server.js脚本之外,还有什么方法可以调用生成数据库的脚本(可以说它被称为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我很感激任何帮助

What do you mean by generate a database?生成数据库是什么意思? Generate tables with columns?生成带有列的表?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM