Using JSON metadata and constants
We have already seen that using node app.js as a command boots our server and, yes, we know about that. But we have not learned to configure the command. Node package manager (npm) provides a way to configure our server start command using a scripts key in a package.json. This can be shown in the following snippet of package.json:
{
    "name": "test-node-app",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
      "test": "echo \"Error: no test specified\" && exit 1",
      "start": "node app.js"
    },
    "author": "",
    "license": "ISC",
    "dependencies": {
        "handlebars": "^4.0.11",
        "hapi": "^17.2.0"
    }
}In the preceding code, we added a start key inside the script's literals and provided our actual Node server start command as the value. Now let's run our new command as follows:
npm startWoot! Our server starts running. Here the start key is already recognized by npm...
 
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
     
         
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                