NodeJS - DAY 07
NodeJS - DAY 07
● It is a tool that keeps a record of every version of your code, so you can
always go back to a previous state if something goes wrong.
● Install Git: If you haven't already, download and install Git on your
computer. You can get it from the official Git website:
https://git-scm.com/downloads
● If you want to work with git in your project →
● Run git init inside the root folder of your project
● This command tells Git to start tracking changes in your project folder.
git status
● After making changes to your project (e.g., writing code), you'll want to save
those changes in Git.
git add .
● The . means "add all changes." You can replace it with specific file names
if needed.
● gitignore
# Other entries...
● If you want to collaborate with others or back up your code online, you can
create a remote repository on platforms like GitHub
● Pull Changes
● If you're collaborating with others, you can fetch their changes and merge
them into your code using git pull.
● Host MongoDB database
● MongoDB Atlas provides a Free cluster for users where you can host your
database for free.
● MongoDB Atlas offers a cloud-based platform for hosting MongoDB
databases
● The free tier allows developers to explore and experiment with the database
without incurring any costs.
● https://www.mongodb.com/atlas/database
● Dotenv
● In your server file (usually the main entry point of your application), require
and configure the dotenv module.
require('dotenv').config();
● Remember to keep your .env file secure and never commit it to a public
version control system like Git, as it may contain sensitive information.
Typically, you should include the .env file in your project's .gitignore file
to prevent accidental commits.
● Now we can test the MongoDB Cluster and check whether our data is
present or not in the online DB
● Now we are going to host our server so that our Application or Endpoints is
accessible to all the users over the Internet.
● We are using localhost and our endpoints are only accessible within our
computer
● We have to make it publicly available, so there are lots of company who
helps us to make our application run 24*7
● Like, AWS, Google Cloud, etc. but these charge too much amount for our
application
● So we are going to use some free services to host our nodeJS application,
which lots of company provides for developer purposes.
● Like, Heroku, Netlify, Render, etc