Skip to main content

Getting Started

We are going to use Homebrew to install NodeJS. When we install NodeJS, the Node Package Manager (npm) will be installed as well, so we can install node packages.

Install#

Open your terminal and run the following commands.

Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install NodeJS
brew install node

If you do not already have a text editor, download and install Visual Studio Code. After you download VSCode launch the application and press CMD+Shift+P. You should see a search box appear enter shell command into the search box and select the option that says Shell Command: Install 'code' command in PATH. Then relauch your terminal.

Create Project#

You have the tools to create your project now you just need somewhere for it to go. Open your terminal and run the following commands.

Create a folder for your projects
mkdir projects
Change the current directory to your projects folder
cd projects

Now that you have a folder for your projects; go to GitHub and create an account if you don't have one. After you have logged into your GitHub account click this link or click the plus button, to create a new repository for your project according to the specs below.

PropertyValue
TemplateNo Template
NameNode Gif Search
DescriptionSearch for Gifs using NodeJS, ExpressJS, and Tenor.
PrivacyEither option

After you've created your repository on GitHub you should see a link like https://github.com/dylanplayer/Node-Gif-Search-Tutorial.git under quick setup. Copy that link and run the following commands in your terminal. Make sure you are still in your projects directory

Clone your GitHub repository. (Don't include the quotes)
git clone "your link"
Change the current directory to your project.
cd Node-Gif-Search

Initalize Node Project#

In your terminal run the following commands, to initalize your project.

Initalize a your project as a node project. (The -y flag tells npm to use the default configuration)
npm init -y
Open your project in VSCode.
code .

Now that your code is open in VSCode press CTRL + ~ to open the terminal. Run the following command.

Create a new file called app.js
touch app.js

Open package.json and set the main file to app.js. This will tell node that our code is in the app file.

package.json
{  ...  "main": "app.js",  ...}

Push To GitHub#

In your terminal run the following commands, to push your current project to GitHub.

Add current changes to staging.
git add .
Commit current changes and call the commit Init. (The -m flag lets us add a message)
git commit -m "Init"
Push local changes to the remote repository. (origin is the name of the remote repository and main is the branch name)
git push origin main