Node.js is a runtime for executing JavaScript on a server rather than inside a web browser. Express.js builds lightweight server-side web applications on top of it. section 2.2
A basic Node.js project uses npm to create and manage its local application environment:
- Run npm init in the project root to create package.json. section 2.2
- Install Express.js with npm install express. section 2.2
- Use package.json to record installed dependencies and support repeatable environments. section 2.5
Listing 2.12 Initializing a new Node.js project
npm init
Use the npm init command to begin a Node.js project and generate its package.json configuration. section 2.2
Run the application on different ports
Start the Express.js server with node main.js; it runs at http://127.0.0.1:3000. Set PORT=3011 before the command to run it at http://127.0.0.1:3011 instead. Stop the process with Control+C. section 2.2.2
Node.js applications provide a practical deployment target before containerization. Consistent dependency tracking helps package and deploy the same application across environments. section 2.0 section 2.5



