- SPA (React,NodeJS,Angular) vs MPA(.Net, Java, PHP)
- React
- React Virtual DOM
- Component
- JSX
- EcmaScript----ES15
- Let vs Const (var)
- Default Parameter
- Arrow Function =>
- OOP
- Spread Operator (...)
- forEach, Map
- JSON Data
- Array Filter - Object Assing
- https://nodejs.org/en
- https://code.visualstudio.com/
- https://desktop.github.com/
- https://github.com/fdikmen/BA40FS_MERN
- Extensions; Prettier - Code formatter, Auto Rename Tag, Auto Close Tag, ES7+ React/Redux/React-Native snippets, Live Share
- npm init ---> package.json
- npm
- npx
- npm vs yarn
- Hello World with React (https://react.dev/learn/start-a-new-react-project) npx create-react-app hello-world
- Folder Structure
- npm run build - FOR BUILD FOLDER
- index.js
- Add file to GitHUB
npm init -y
- Module System
(Babel,
npm install babel-cli babel-preset-es2015
,"start":"babel-node main.js --presets es2015"
, import-export-default-as-*) - Component (extends)
- Dikkat Edilmesi Gerekenler;
1. Live Share de çalışma,
2. Komutları İlgili Klasörde Yazmaya Çalış,
3. Uygulama Oluşturmak İçin
npx create-react-app [APP-NAME]
komutunu kullan, 4. Eğer eklentilerde bozulmalar oluyorsa;ES7+ React/Redux/React-Native snippets
harici eklentileri silebilirsiniz.
- props
- props
- React Developer Tools
- PropTypes
- Constructor
- Style
- Combine styles (Spread & Object.Assing)
- Events & Bind
- Get Github Repo
- send function with props & parameters
- Data Bind Methods a. With Function b. in Constructor c. With Arrow Function
- State
- re-Render (React Diff - React Virtual DOM)
- Counter (First App)
- Class vs Functional Comp. (Stateful vs Stateless)
- PhoneBook (Second app) --> npx create-react-app phonebook
Component, import-export, classComponent, PropTypes, State, Spread (Array Merge), props (array,function)
React Developer Tools, Array.Filter & Array.indexOf
- Summary for Phone Book App
- LifeCycle - React LifeCycle
- React Component LifeCycle [https://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/] -- Mounting - Updation - Unmounting
- I. Constructor (Mounting)
- II. Render -> PURE
- III. ComponentDidMount
- IV. ComponentDidUpdate
- V. ComponentWillUnmont
- VI. getDerivedStateFromProps
- VII. shouldComponentUpdate
- VIII. getSnapshotBeforeUpdate
- FETCHING MOCK ==> https://jsonplaceholder.typicode.com/
- Fetch (Summary)
- Axios
npm i axios
- Router
npm i react-router-dom
Project Stop => CTRL + C 04. BrowserRouter (wrapping) - Link - Routes | Route (path-element) MainLink-HomeLink(/) - No Match(*) - Read Parameter - NavLink
- Summary
- Advanced Components - Higher Order Component
- Summary
- Advanced Components - Higher Order Component
- Redux - npm i redux react-redux
Sample npm i redux react-redux axios Means npm i redux npm i react-redux npm i axios SAVE npm i [libName] --save FORCE npm i [libNAME] -f (or --force)
- UI-View-Comp. => ACTION => dispatch => STORE => REDUCER => subscribe => UI-View-Comp.
- createStore , reducer(like function), .getState() , dispatch
- npm i @reduxjs/toolkit
- SUGGEST Intellisense -> Suggest Snippet -> ShortCut
Folder Structure https://medium.com/@fdikmen/a-redux-toolkit-project-structure-guide-58093baa88a5
Home Work https://github.com/fdikmen/BA40FS_MERN/blob/main/Lesson12/HomeWork.md
- redux-toolkit RTK
- Folder structure
- Slice (IntialState - Name - Reducer - Aciton)
- Store
- Provider
- useDispatch
- redux devTools Extension
- useSelector https://redux-toolkit.js.org/introduction/getting-started
npx create-react-app [appName]
npm i @redux-toolkit
npm i react-redux
Create Folder Structure
Create Sample Files (Comp., Slice)
Create Store
https://jsonplaceholder.typicode.com/users/2
- middleware
- HOOKS
- STATE => useState
- LIFECYCLE => useEffect
next suggest => [Next.JS]
- Summary
- API - Http Methods (CRUD)
- mockapi.ai
- Postman
- NPM?
npm i [packageName]
npm install [packageName]
Project Start File --> start file(package.json)
npm init
npm init -y
- import (React) vs require (NodeJS)
React
import [CustomName] from '[libName]'
NodeJS
const [CustomName] = require('[libName]')
const slugify = require('slugify')
- Global vs Local Package
Global
npm i -g [packageName]
npm i --global [packageName]
Local
npm i [packageName]
Global Package List
npm list -g
npm list -g --depth=0
Windows Console Clear => cls MacOS/Linux Console Clear => clear
Use global package
npm link [package]
- Create a Project with npm (Create a package.json file) Manuel
npm init
Auto
npm init -y
Settings Sample
npm set init.author.name "fdikmen" ===> npm config ls -l
- Install a Module (Lib)
npm install [moduleName]
npm i [moduleName]
- License
https://choosealicense.com/licenses/
- npm-cache
- npm i npm-cache
- npm i [packageName] => npm-cahce install [packageName]
-
-s --save --no-save
-
Old Version Install Custom vesion for package
npm i [packageName]@[Version]
List outdated packages
npm outdated
Update packages
npm update
- Package for Developer
npm i [packageName] --save-dev
- Define script in package.json file
npm run [commandName]
- Install Multiple Package
npm i [packageName01] [packageName02] [packageName03] ...
- Remove a Package
npm uninstall [packageName]
-
Stop Command on Termianl [CTRL + C]
-
Start NodeJS Project
node [mainFileName]
- Event & Emitter
// import events module
const events = require('events')
// create an eventEmitter object for management events
const eventEmitter = new events.EventEmitter()
For Create => on or once
For Trigger => emit
- __filename & __dirname
- Summary & BUG FIXED: once
- Extensions for NodeJS npm Intellisense, ESLint, REST Client, ShortCuts for VSCode [https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf]
- Callback Function
- Promise => function.then(+).catch(-)
- File System (require('fs'))
const fs = require('fs');
Read File - Write File - Remove File
// fs.readFile('filename', callback)
// fs.writeFile('filename', 'content', callback)
// fs.appendFile('filename', 'content', callback)
// fs.unlink('filename', callback)
- HTTP Server
const http = require('http');
Create Server
const myserver = http.createServer(callback)
const myserver = http.createServer((req,res)=>{})
Define Server Port
myserver.listen(PortNumber)
- nodemon
npm install -g nodemon (Windows - MacOS - Linux)
sudo npm install -g nodemon (Optional -> MacOS - Linux)
- HTML doc serve with http nodejs server
- HTTP Methods (GET - POST - PUT - DELETE)
- Route Example
- Streams Chunk -> Streams of Data
- Stream Types Readable - Writeable - Readable/Writeable (transform)
- NodeJS Streaming Logic => eventEmitter.on() -> eventEmitter.emit() -> response.end()
- Create ReadableStream
- Create WriteableStrem with Pipeline
- Summary
- npm install express
- node-snippets
- PUG
- convert -> HTML to PUG/JADE
- PUG Sample with ExpressJS
- npm i express
- Created by "node-express" snippet with node-snippets
- run project with nodemon
- npm install pug
- Sass/Less/Stylus/Pug/Jade/Typescript/Jav for PUG snippets
- vscode-faker for FAKE DATA
- Summary
- Define STATIC FOLDER with ExpressJS
- Routing with ExpressJS
- Postman (https://www.postman.com/downloads/)
- Using keywords (?,*,+) with routing
- Http Methods with Routing (GET - POST - PUT - DELETE - ALL)
- Parameters with Routing (:params)
- Router Object in ExpressJS (express.Router())
- Define express,route in Route File
- Move route codes to Route File
- Convert "app" to "router"
- Module Export
- import route file
- Middleware
- Error Handler
- Express Application Generator
- npx express-generator
- npm i
- npm start (=> "start": "nodemon ./bin/www")
- Summary
- DBMS (Database Management System)
- NoSQL (NotOnlySQL)
- MongoDB
-
Setup File; https://www.mongodb.com/try/download/community-kubernetes-operator
-
For Windows; https://ismailkasan.medium.com/windows-10da-mongo-db-kurulumu-41341c057262
-
For Macos/Linux;
- https://brew.sh/index_tr (install brew)
- brew update
- brew install mongodb
- sudo mkdir -p /data/db
- sudo chown -R $USER /data/db
- brew services start mongodb
- mongo
- For Windows;
- Download MSI File ans Install with next next (https://www.mongodb.com/try/download/community-kubernetes-operator)
- cd C:\ (in Admin CMD)
- md "data\db" (in Admin CMD)
- "[mongoDb-bin-folder-path]\mongod.exe" --dpath="C:\data\db" (in Admin CMD)
- Other Steps ...
npx express-generator
npm install -g express-generator
npm i nodemon -g
ERROR: nodemon permission denied windows with powershell script
Powershell (run as Admin)
BUG FIXED:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
https://www.mongodb.com/try/download/community-kubernetes-operator
- Summary
- What is Connector?
- Mongoose https://mongoosejs.com/docs/index.html
- Using mongoDB on cloud (MongoDB Atlas) https://www.mongodb.com/atlas/database
- MongoDB Compass
- Summary
- What is Connector/Driver?
- Mongoose
- Install & Using Mongoose
- CRUD Operations with Mongoose Create, Read, Update, Delete, Read All, Delete All, Aggregate (JOIN)
- Summary
- Routes, Models, Controllers Folders
- Coding MovieApp API (https://github.com/fdikmen/movieapp-api)
- npx express-generator --view=pug movieapp-api cd movieapp-api npm install npm start
- Create database (MovieAppDB) on Compass
- npm install mongoose
- Create and Codes db.js for connetion to MongoDB
- Summary
- Get a Movie API
- Using Error Handler
- Update a Movie
- Delete a Movie
- Get the top 10 movies
- Movies between two dates
Windows
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
MacOS/Linux
sudo [...]
A. Summary B. Coding for Director EndPoints 1. Create Director Model (Director.Model.js) 2. Create Director Route (director.routes.js) 3. Import & Use Director Route (in app.js) 4. Create Routes 4.1. Create Director POST Endpoint (/) 4.2. Create Director GET Endpoint (/) 4.3. Create Director GET Endpoint (/WithMovies) 4.4. Create Director GET Endpoint (/:director_id) 4.5. Create Director PUT Endpoint (/:director_id) 4.6. Create Director DELETE Endpoint (/:director_id) 4.7. Create Movie GET Endpoint (/listWithDirector)
A. Summary
B. FullStack Form Project
Link;
https://github.com/fdikmen/Edu-MERN-Contact-Form-App
- Summary NEW Repository => https://github.com/fdikmen/Edu-MERN-BA.G01
- Build & Production & Hosting/Server/SSL & Docker Containers
Step by step hosting nodejs app;
https://dev.to/techfortified/how-to-host-nodejs-express-restful-api-on-cpanel-2e7c
Free SSL;
https://www.sslforfree.com/ - JS PROMISES
- React LAZY
- React Suspense
- Isomorphic - SSR - Server Side Rendering
- NextJS
- Questions?