This repository contains a collection of simple Node.js programs for demonstration purposes.
Installer method Just download the installer from [Node.js website] (https://nodejs.org/en/#home-downloadhead) --> Install it
If you want to downlad the package with bash
curl "https://nodejs.org/dist/latest/node-${VERSION:-$(wget -qO- https://nodejs.org/dist/latest/ | sed -nE 's|.*>node-(.*)\.pkg</a>.*|\1|p')}.pkg" > "$HOME/Downloads/node-latest.pkg" && sudo installer -store -pkg "$HOME/Downloads/node-latest.pkg" -target "/"
Using Homebrew
brew install node
Using Macports
port install nodejs<major version>
# Example
port install nodejs7
'''
Fork the repository:
Click on the "Fork" button at the top right corner of this repository to create a copy in your GitHub account.
Clone the forked repository to your local machine:
git clone https://github.com/your-username/newton-school-lessons.git
Navigate to the project directory:
cd newton-school-lessons
Install dependencies for the main application using npm:
If the express
module is required, run the following command in the terminal to dowload/update the modules:
npm install
Run the main application using Node.js:
node server.js
This will start the server, and you should see output indicting that the server is running.
Open your web browser and visit http://localhost:PORT to see the main application in action.
Note: The default port is set to 3000. If you've configured a diffeent port, replace PORT
in the URL with the actual port number.
Explore individual program folders:
Navigate to each program folder using the cd
command:
cd program1
bash cd program2
Replace `program1` and `program2` with the actual names of the folders representing individual programs.
Install dependencies and run each program in its respective folder:
For each program, run the following commands:
bash
cd program-folder
npm install
node server.js
Replace program-folder
with the actual folder nam of the program.
server.js
file to understand the Node.js code.