marp | theme | paginate |
---|---|---|
true |
default |
true |
This is a repository intended for the mernstack backend beginners to gain all the essential knowledge along with few minor projects
Try to install the following softwares/tools
- Install nodejs - click here
- Install any code editor of your choice
- create an account in Github.com
- Install Git
With all the necessary installations, we have to create seperate project folder and execute the test.js file from the terminal
Follow the steps
-
open command prompt
-
cd Desktop
-
mkdir MernStack
-
cd MernStack
-
mkdir MernStackProject
-
code .
create a new file called test.js and use the code from the Hour1-Folder from the repository
Open the terminal and type the following command in the terminal
- node test It will run the test.js code
Now let us jump into the core concepts of Nodejs, ExpressJs and MongoDB.
We will start with NodeJs, and all of these heirarchial lectures will help to build and end to end project on your own
CLASS-2 use the code from the Hour2-Folder from the repository
- It constitutes of files.js file which has file handling module concepts, how to read, write, delete files
- modules.js and people.js contitues of comm. between modules(here user defined) and how exporting certain functionalities from one module impact the other one.
- Streams.js exams the data streams from one to another , through chunks instead of doing it in one go.
CLASS-3 use the code from the Hour3-Folder from the repository
- It constitutes of serverSample.js file, which explains how to create a simple server using the built in modules Server listening to the request at port mentioned (here 3000)
Use the command to run the server everytime when there is a change
- node simpleServer
CLASS-4 use the code from the Hour4-Folder from the repository
- It constitutes of server.js file which has required modules and all the routing techniques to different web pages as a response from the server
- Try to implement this file step by step instead of going all at once, so that you can understand how it is being built heirachially.
Use the command to run the server everytime when there is a change
- node server
CLASS-5 use the code from the Hour5-Folder from the repository
- It constitutes of server.js file which has required modules and all the routing techniques to different web pages as a response from the server using switch cases for effective routing.
- Install packages using NPM,Install Nodemon and other packages.
- Importance of package.json file, how to maintian the version compatibility, modules installed updated in the json file for easy reference for anyone looks for the dependencies of the project.
- npm install -g nodemon Then use the following command hereafter to restart the server, and it is not needed to do it again and again
- nodemon server Use this command in the terminal
CLASS-6-Expressjs use the code from the Hour6-Folder from the repository
- Its a 3rd party package called Express. Express is a framework which helps us to easily create node.js web applications. Its iseasy to write clean code.
Use the following command to install Expressjs
- npm install express
we will create a new express file called app.js and do all the simple routing and redirects.
- **nodemon app
CLASS-7 use the code from the Hour7-Folder from the repository
View engines allow us to inject dynamic content & variables into html templates before sending them to the browser
- we will create a new express file called app.js and do all the simple routing and redirects.
- npm install ejs
- nodemon app
CLASS-8 use the code from the Hour8-Folder from the repository Detailing about middleware, use, get fucntions Use funcations fire for every kind of request unlike get function.
next() function to fire the next operations
- npm install morgan For installing 3rd party middleware called morgan
- Static middleware to restrict what to access and what cant be accessed from the browser (here style.css in public)
Run the server
- nodemon app
CLASS-9 use the code from the Hour9-Folder from the repository
we'll hook our node express app up with mongodb, a NoSQL database. Well use mongodb atlas to set up our database online
click here for db Create a free account.
Then install mangoose, a third party package
- nodemon app