How can I make a command in the package.json file, that executes two commands for the terminal (console) one after another?
This question refers to node.js and NPM package.
I have a "server" folder in which I installed http server and npm package.json file, and there is also a folder "webdir" (inside "server" folder) with a web page.
I can run the web server manually, or by typing in the terminal: node [path to the file that runs the server]
, but I need this to happen automatically on command npm start
. And the server must be activated from the "webdir" folder, so that I could immediately go to my web page at localhost: 8080
.
To do this, I need to write in the terminal (console) two commands one after another:
cd webdir
node [path to the file that runs the Web server]
How to make a npm command, that executes two commands in the console (one after another)?
Here is the working code with a single line script:
"scripts": {
"start": "node (...)/node_modules/http-server/bin/http-server"
},