One important function of the main
key is that it provides the path for your entry point. This is very helpful when working with nodemon
. If you work with nodemon
and you define the main
key in your package.json
as let say "main": "./src/server/app.js"
, then you can simply crank up the server with typing nodemon
in the CLI with root as pwd instead of nodemon ./src/server/app.js
.