├── backend
├── app.js
├── bin
│ └── www
├── config
│ ├── Config.js
│ └── database.js
├── controllers
│ ├── MovieController.js
│ ├── ReviewController.js
│ └── UsersController.js
├── middleware
│ ├── DemoLogger.js
│ └── auth.js
├── model
│ ├── movies.js
│ ├── review.js
│ └── user.js
├── package-lock.json
├── package.json
├── public
│ ├── demo.txt
│ └── stylesheets
│ │ └── style.css
├── routes
│ ├── admin.js
│ ├── index.js
│ ├── movies.js
│ ├── reviews.js
│ └── users.js
├── services
│ ├── MovieService.js
│ ├── ReviewService.js
│ └── UserService.js
└── views
│ ├── error.jade
│ ├── index.jade
│ └── layout.jade
├── chapter1
├── Dynamic.html
├── Grammar.html
├── Semantics.class
├── Semantics.java
├── Sematics.class
├── backend.js
├── demo
├── demo.go
├── demo.js
├── demo.ts
└── tempCodeRunnerFile.go
├── chapter10
├── Module.html
├── MyNodeModule.js
├── UseEs6.html
├── es6_module.js
└── use_module.js
├── chapter11
├── Console.html
├── Date.html
├── Endian.html
├── Error.html
├── EventLoop.html
├── Internalization.html
├── JSON.html
├── Map.html
├── ParseDate.html
├── RE2.html
├── RE3.html
├── RE_Method.html
├── RE_email.html
├── RegEngine.html
├── RegExp.html
├── RegularExpression.html
├── Set.html
├── Sticky.html
├── Timer.html
├── TypeArray.html
├── URLDemo.html
└── WeakMap.html
├── chapter12
├── CustomIterator.html
├── Generator.html
├── GeneratorTwo.html
├── GeneratorUseCase.html
├── Iterator.html
├── IteratorUseCase.html
└── python_loop.py
├── chapter13
├── Async2.html
├── AsyncAwat.html
├── AsyncRead.js
├── CustomFetch.html
├── Event.html
├── Fetch.html
├── FetchTwo.html
├── GetUrl.js
├── Promise.html
├── Promise2.html
├── PromiseAll.html
├── PromiseErrorHandling.html
├── SequentialPromise.html
└── SyncRead.js
├── chapter14
├── AOP.html
├── ClassType.html
├── CustomArray.html
├── CustomMatch.html
├── DynamicInheritance.html
├── MVC.html
├── MVCWithTemplate.html
├── MetaProgram.html
├── PropertyDescriptor.html
├── Prototype.html
├── Proxy.html
├── Seal.html
├── Symbol.html
└── Template.html
├── chapter15
├── AddEvent.html
├── Another2.js
├── Attribute.html
├── Closest.html
├── DOMScripting.html
├── Error.html
├── Event.html
├── EventPerformance.html
├── EventReturn.html
├── Global.html
├── IndexedDBDemo.html
├── LazyLoad.html
├── Location.html
├── MessageChannel.html
├── Nodes.html
├── Selector.html
├── Storage.html
├── Style.html
├── Timer.html
├── Traversal.html
├── WorkerThread.html
├── XSSDemo.html
├── another.js
├── async.js
├── clock.js
├── lib.js
├── module.js
└── worker.js
├── chapter16
├── Buffer.js
├── CopyFile.js
├── EventEmitterDemo.js
├── Hello.js
├── PipeDemo.js
├── StreamDemo.js
├── async.js
├── axios_call.js
├── copy.txt
├── hello.txt
├── hello.txt.gz
├── httpRequest.txt
├── pipe.txt
├── promisify.js
├── rest_call.js
├── tcp_server.js
├── tempCodeRunnerFile.js
├── transform.js
└── web_server.js
├── chapter2
├── NaN.html
├── demo
├── demo.go
├── iteral.html
├── lexical.html
├── line_break.py
├── number.html
├── optionalSemicolon.html
└── zero.html
├── chapter3
├── Arithmetic.html
├── Boolean.html
├── Conversion.html
├── DateTime.html
├── Destructuring.html
├── Equality.html
├── FloatingPoint.html
├── Global.html
├── LetConst.html
├── LetvsVar.html
├── MutableImmutable.html
├── NullAndUndefined.html
├── ObjToBoolean.html
├── ObjectToString.html
├── ParseInt.html
├── TypeConversion.html
├── UndeclaredVar.html
├── ValueRef.html
├── string_demo.html
├── string_method.html
├── template.html
└── variable.go
├── chapter4
├── Arithmetic.html
├── Assignment.html
├── Bitwise.html
├── ConditionalOp.html
├── Delete.html
├── Equality.html
├── Eval.html
├── Expression.html
├── FirstDefined.html
├── In.html
├── Increment.html
├── InstanceOf.html
├── Logical.html
├── PlusOp.html
├── Precedence.html
├── Relational.html
├── Subtraction.html
├── TypeOf.html
├── comparison.html
├── division.go
└── void.html
├── chapter5
├── Break.html
├── Conditional.html
├── Continue.html
├── DangliingElse.html
├── DivWithMultipleReturn.html
├── DoWhile.html
├── ElseIf.html
├── ExpressionStatement.html
├── Finally.html
├── For.html
├── ForIn.html
├── ForOf.html
├── ForOfMap.html
├── LabelBreak.html
├── Loop.html
├── NewObject.html
├── Object.html
├── ObjectCreate.html
├── SwithProblem.html
├── Throw.html
├── UseStrict.html
├── With.html
├── jump.go
├── multiple_ret.go
├── return.html
└── tempCodeRunnerFile.go
├── chapter6
├── AssociatveArray.html
├── ExtendObjectLiteral.html
├── Method.html
├── ObjectCreate.html
├── ObjectProperty.html
├── Of.html
├── Serialization.html
├── enumerate.html
└── extend.html
├── chapter7
├── AddRemove.html
├── Array.html
├── ArrayLikeObj.html
├── ArrayMethod.html
├── ArrayOfArray.html
├── ArraySearch.html
├── Concat.html
├── CopyWithin.html
├── CreateArray.html
├── Every.html
├── Filter.html
├── Flat.html
├── ForEachForMultiArray.html
├── HetrogenousArray.html
├── Map.html
├── ReadWrite.html
├── Reduce.html
├── ReduceExample.html
├── SelectionSort.html
├── Slice.html
├── Sort.html
├── Splice.html
└── StringAsArray.html
├── chapter8
├── Apply.html
├── Argument.html
├── CallApply.html
├── CheckArgument.html
├── Destructuring.html
├── FirstClass.html
├── Function.html
├── FunctionCont.html
├── FunctionLength.html
├── FunctionProperty.html
├── Invocation.html
├── LongParameterAsObject.html
├── Module.html
├── NestedFunction.html
├── Parameter.html
├── Private.html
├── RestParameter.html
└── parallel_assignment.py
├── chapter9
├── ClassBased.html
├── Composition.html
├── CompositionTwo.html
├── ExtendNativeObject.html
├── Extension.html
├── FunctionConstructor.html
├── GetterSetter.html
├── Inheritance.html
├── Private.html
└── StaticMethod.html
├── fp
├── Combinator.html
├── Compose.fsx
├── Currying.fsx
├── Currying.html
├── CurryingUtil.html
├── CustomCurry.html
├── CustomFilter.html
├── EitherMonad.html
├── FPDemo.fsx
├── FilterWithReduce.html
├── FlatMap.html
├── ForkJoin.html
├── HigherOrder.html
├── MayBeOrElse.html
├── MayBeProblem.html
├── MethodChaining.html
├── Monad.html
├── OrCombinator.html
├── PlainJSVersion.html
├── Pure.html
├── RadmaUtility.html
├── RailwayOrientedProgramming.html
├── RailwayOrientedProgramming2.html
├── RamdaCompose.html
├── ReduceRight.html
├── SequenceCombinator.html
├── Wrapper.html
└── pipe.html
├── frontend
├── .idea
│ ├── frontend.iml
│ ├── misc.xml
│ ├── modules.xml
│ └── vcs.xml
├── README.md
├── package-lock.json
├── package.json
├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ └── robots.txt
└── src
│ ├── App.css
│ ├── App.js
│ ├── App.test.js
│ ├── app
│ └── store.js
│ ├── components
│ ├── AcceptComponent.js
│ ├── DefaultProperty.js
│ ├── FocusDemo.js
│ ├── Hello.js
│ ├── class_component
│ │ ├── ApiLoader.js
│ │ ├── Counter.js
│ │ ├── EventComponent.js
│ │ ├── Greeting.js
│ │ ├── LabelComponent.js
│ │ ├── ListItem.js
│ │ ├── Loader.js
│ │ └── Welcome.js
│ ├── context
│ │ ├── MyContext.js
│ │ ├── ParentComponent.js
│ │ └── UpdateContext.js
│ ├── form
│ │ └── FormDemo.js
│ ├── formik
│ │ ├── BasicForm.js
│ │ └── YupForm.js
│ ├── forward_ref
│ │ └── FancyButtonDemo.js
│ ├── fragment
│ │ └── FragmentDemo.js
│ ├── function_as_child
│ │ └── RepeatDemo.js
│ ├── hoc
│ │ └── logProps.js
│ ├── hooks
│ │ ├── Child.js
│ │ ├── ComplexObject.js
│ │ ├── ContextHookDemo.js
│ │ ├── HookCounter.js
│ │ ├── MemoHook.js
│ │ ├── TextInputWithFocusButton.js
│ │ ├── ToDoWithCustomReducer.js
│ │ ├── UseIdDemo.js
│ │ ├── UseImperativeParent.js
│ │ └── reduce
│ │ │ ├── CounterWithReducer.js
│ │ │ ├── CounterWithState.js
│ │ │ └── ToDoWithReducer.js
│ ├── lazy
│ │ ├── DynamicallyLoadedComponent.js
│ │ ├── ErrorBoundary.js
│ │ └── LazyDemo.js
│ ├── portal
│ │ └── Modal.js
│ ├── render_prop
│ │ └── MouseTracker.js
│ ├── runtime_type
│ │ └── RuntimeTypeDemo.js
│ ├── tab
│ │ ├── Tab.css
│ │ └── Tab.js
│ ├── thrid_party
│ │ └── DatePicker.js
│ ├── uncontrolled
│ │ └── UnControlled.js
│ └── unit_testing
│ │ ├── LoadUser.js
│ │ ├── LoadUser.test.js
│ │ └── User.js
│ ├── features
│ ├── counter
│ │ ├── ReduxCounter.js
│ │ └── counterSlice.js
│ ├── movie-list
│ │ ├── MovieDetail.css
│ │ ├── MovieDetails.js
│ │ ├── MovieList.js
│ │ ├── MoviePreview.css
│ │ ├── MovieReview.css
│ │ ├── MovieReview.js
│ │ ├── movieApi.js
│ │ └── movieSlice.js
│ ├── review
│ │ ├── reviewApi.js
│ │ └── reviewSlice.js
│ └── todo
│ │ ├── ReduxToDo.js
│ │ └── toDoSlice.js
│ ├── index.css
│ ├── index.js
│ ├── logo.svg
│ ├── pages
│ ├── MovieListDetailPage.js
│ └── MovieListPage.js
│ ├── reportWebVitals.js
│ ├── routes
│ ├── Expense.js
│ ├── Invoice.js
│ └── NotFound.js
│ ├── setting
│ ├── API.js
│ └── our_axios.js
│ ├── setupTests.js
│ └── utils
│ ├── Util.js
│ └── Util.test.js
├── mongodb
└── command.txt
├── postman
└── React_3rd_batch_API.postman_collection.json
├── react-redux-typescript
├── .idea
│ ├── misc.xml
│ ├── modules.xml
│ ├── react-redux-typescript.iml
│ └── vcs.xml
├── README.md
├── package-lock.json
├── package.json
├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ └── robots.txt
├── src
│ ├── App.css
│ ├── App.test.tsx
│ ├── App.tsx
│ ├── app
│ │ ├── hooks.ts
│ │ └── store.ts
│ ├── component
│ │ └── PrivateRoute.tsx
│ ├── features
│ │ ├── auth
│ │ │ ├── authApi.ts
│ │ │ └── authSlice.ts
│ │ ├── counter
│ │ │ ├── Counter.module.css
│ │ │ ├── Counter.tsx
│ │ │ ├── counterAPI.ts
│ │ │ ├── counterSlice.spec.ts
│ │ │ └── counterSlice.ts
│ │ ├── movie
│ │ │ ├── Movie.css
│ │ │ ├── MovieList.tsx
│ │ │ ├── MovieUI.tsx
│ │ │ ├── movieApi.ts
│ │ │ └── movieSlice.ts
│ │ ├── review
│ │ │ ├── Review.css
│ │ │ ├── ReviewListUI.tsx
│ │ │ ├── ReviewUI.tsx
│ │ │ ├── reviewApi.ts
│ │ │ └── reviewSlice.ts
│ │ └── todos
│ │ │ ├── ToDoUI.tsx
│ │ │ └── todoSlice.ts
│ ├── index.css
│ ├── index.tsx
│ ├── logo.svg
│ ├── pages
│ │ ├── HomePage.tsx
│ │ ├── LoginPage.tsx
│ │ ├── LogoutPage.tsx
│ │ ├── MovieDetailsPage.tsx
│ │ └── MovieListPage.tsx
│ ├── react-app-env.d.ts
│ ├── reportWebVitals.ts
│ ├── services
│ │ └── authService.ts
│ ├── setting
│ │ ├── API.ts
│ │ └── our_axios.ts
│ └── setupTests.ts
└── tsconfig.json
└── typescript
├── AnyType.js
├── AnyType.ts
├── Hello.js
├── Hello.ts
├── Problem.html
├── callback.js
├── callback.ts
├── gencallback.js
├── gencallback.ts
├── generic.ts
├── union.js
└── union.ts
/backend/config/Config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | config:{
3 | TOKEN_SECRET : "!^&!^#!722!@@(!" //should be store in env file,
4 | }
5 | }
--------------------------------------------------------------------------------
/backend/config/database.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | db: 'mongodb://0.0.0.0:27017/react_third_batch'
3 | }
--------------------------------------------------------------------------------
/backend/middleware/DemoLogger.js:
--------------------------------------------------------------------------------
1 | function logger(req,res,next)
2 | {
3 | console.log(`${new Date()} => ${req.url}`);
4 | next();
5 | }
6 | module.exports = {
7 | logger
8 | }
--------------------------------------------------------------------------------
/backend/middleware/auth.js:
--------------------------------------------------------------------------------
1 | const jwt = require('jsonwebtoken');
2 | const bcrypt = require('bcrypt');
3 |
4 | const { config } = require('./../config/Config');
5 |
6 | const verifyUserToken = (req, res, next) => {
7 | let token = req.headers.authorization;
8 | //console.log('Token ',token);
9 | if (!token) return res.status(401).send("Access Denied / Unauthorized request");
10 |
11 | try {
12 | token = token.split(' ')[1] // Remove Bearer from string
13 |
14 | if (token === 'null' || !token) return res.status(401).send('Unauthorized request');
15 |
16 | let verifiedUser = jwt.verify(token, config.TOKEN_SECRET); // config.TOKEN_SECRET => 'secretKey'
17 | if (!verifiedUser) return res.status(401).send('Unauthorized request')
18 |
19 | req.user = verifiedUser; // user_id
20 | next();
21 |
22 | } catch (error) {
23 | console.log(error);
24 | res.status(400).send("Invalid Token");
25 | }
26 |
27 | }
28 | module.exports = {
29 | verifyUserToken
30 | }
--------------------------------------------------------------------------------
/backend/model/movies.js:
--------------------------------------------------------------------------------
1 | //Filename: Posts.js
2 | const mongoose = require('mongoose');
3 | const Schema = mongoose.Schema;
4 | const MovieSchema = new Schema({
5 | title: {
6 | type: String,
7 | required: true,
8 | },
9 | director: {
10 | type:{
11 | name:{
12 | type: String,
13 | required: true,
14 | },
15 | phoneNo:{
16 | type: String
17 | }
18 | },
19 | required:false,
20 | },
21 | year: {
22 | type: Number,
23 | required: true,
24 | }
25 | });
26 | module.exports = mongoose.model('Movies', MovieSchema);
--------------------------------------------------------------------------------
/backend/model/review.js:
--------------------------------------------------------------------------------
1 | //Filename: Posts.js
2 | const mongoose = require('mongoose');
3 | const Schema = mongoose.Schema;
4 | const ReviewSchema = new Schema({
5 | movie: {
6 | type: Schema.Types.ObjectId,
7 | ref: "Movies"
8 | },
9 | rating: {
10 | type: Number,
11 | required: true,
12 | },
13 | review: {
14 | type: String,
15 | required: true,
16 | },
17 |
18 | });
19 | module.exports = mongoose.model('Reviews', ReviewSchema);
--------------------------------------------------------------------------------
/backend/model/user.js:
--------------------------------------------------------------------------------
1 | //Filename: Posts.js
2 | const mongoose = require('mongoose');
3 | const Schema = mongoose.Schema;
4 | const UserSchema = new Schema({
5 | username: {
6 | type: 'String',
7 | required: true,
8 | trim: true,
9 | unique: true
10 | },
11 | password: {
12 | type: 'String',
13 | required: true,
14 | trim: true
15 | }
16 | });
17 | module.exports = mongoose.model('User', UserSchema)
--------------------------------------------------------------------------------
/backend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "backend",
3 | "version": "0.0.0",
4 | "private": true,
5 | "scripts": {
6 | "start": "node ./bin/www"
7 | },
8 | "dependencies": {
9 | "bcrypt": "^5.0.1",
10 | "cookie-parser": "~1.4.4",
11 | "cors": "^2.8.5",
12 | "debug": "~2.6.9",
13 | "express": "~4.16.1",
14 | "http-errors": "~1.6.3",
15 | "jade": "~1.11.0",
16 | "jsonwebtoken": "^8.5.1",
17 | "mongoose": "^6.2.7",
18 | "morgan": "~1.9.1"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/backend/public/demo.txt:
--------------------------------------------------------------------------------
1 | Just demo data
--------------------------------------------------------------------------------
/backend/public/stylesheets/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding: 50px;
3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
4 | }
5 |
6 | a {
7 | color: #00B7FF;
8 | }
9 |
--------------------------------------------------------------------------------
/backend/routes/admin.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 |
4 | router.get('/', function(req, res, next) {
5 | res.send('Admin home');
6 | });
7 | router.get('/ab?cd', function(req, res, next) {
8 | res.send('Ab?cd');
9 | });
10 | router.get('/profile/:adminId(\\d+)', function(req, res, next) {
11 | console.log('Admin Id ',req.params.adminId);
12 | res.send(`Admin ${req.params.adminId}`);
13 | });
14 | router.get('/multi', function(req, res, next) {
15 | console.log('Multi First handler');
16 | //res.send(`Multi First handler'`);
17 | next();
18 | });
19 | router.get('/multi', function(req, res, next) {
20 | console.log('Multi Second handler');
21 | res.send(`Multi Second handler'`);
22 | });
23 |
24 |
25 | module.exports = router;
--------------------------------------------------------------------------------
/backend/routes/index.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 |
4 | /* GET home page. */
5 | router.get('/', function(req, res, next) {
6 | res.render('index', { title: 'Turing' });
7 | });
8 |
9 | module.exports = router;
10 |
--------------------------------------------------------------------------------
/backend/routes/movies.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | let movies = require('../controllers/MovieController');
4 |
5 | router.get('/', movies.getAllMovie);
6 | router.get('/:movieId', movies.getMovieById);
7 | router.get('/title/:title', movies.findMovieByTitle);
8 | router.post('/', movies.newMovie);
9 | router.patch('/:movieId', movies.updateMovie);
10 | router.delete('/:movieId', movies.deleteMovie);
11 | module.exports = router;
12 |
--------------------------------------------------------------------------------
/backend/routes/reviews.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 | let review = require('../controllers/ReviewController');
4 |
5 | router.get('/',review.getAllReview);
6 | router.get('/:reviewId',review.getReviewById);
7 | router.get('/movie/:movieId',review.getReviewByMovieId);
8 | router.post('/',review.saveReview);
9 | router.patch('/:reviewId', review.updateReview);
10 | router.delete('/:reviewId', review.deleteReview);
11 | module.exports = router;
--------------------------------------------------------------------------------
/backend/services/MovieService.js:
--------------------------------------------------------------------------------
1 | let Movies = require('../model/movies');
2 | const getAllMovie = async ()=>
3 | {
4 | return Movies.find();
5 | };
6 | const getMovieById= async (movieId)=>{
7 | return Movies.findById(movieId);
8 | }
9 | const newMovie = async(movie)=>
10 | {
11 | const newMovie = new Movies(movie);
12 | return newMovie.save();
13 | }
14 | const updateMovie = async(movieId,movie)=>{
15 | const newMovie = await Movies.findByIdAndUpdate(movieId, movie,{new: true});
16 | return newMovie;
17 | }
18 | const deleteMovie = async(movieId)=>{
19 | const deletedMovie = await Movies.findByIdAndDelete(movieId);
20 | return deletedMovie;
21 | }
22 | const searchMovieByTitle = async(movieTitle)=>
23 | {
24 | const movies = await Movies.find({
25 | title: {
26 | $regex:movieTitle
27 | }
28 | });
29 | return movies;
30 | }
31 | module.exports = {
32 | getAllMovie,
33 | getMovieById,
34 | newMovie,
35 | updateMovie,
36 | deleteMovie,
37 | searchMovieByTitle,
38 | }
--------------------------------------------------------------------------------
/backend/views/error.jade:
--------------------------------------------------------------------------------
1 | extends layout
2 |
3 | block content
4 | h1= message
5 | h2= error.status
6 | pre #{error.stack}
7 |
--------------------------------------------------------------------------------
/backend/views/index.jade:
--------------------------------------------------------------------------------
1 | extends layout
2 |
3 | block content
4 | h1= title
5 | p Welcome to #{title}
6 | p Hello
--------------------------------------------------------------------------------
/backend/views/layout.jade:
--------------------------------------------------------------------------------
1 | doctype html
2 | html
3 | head
4 | title= title
5 | link(rel='stylesheet', href='/stylesheets/style.css')
6 | body
7 | block content
8 |
--------------------------------------------------------------------------------
/chapter1/Dynamic.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
--------------------------------------------------------------------------------
/chapter1/Grammar.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello
4 |
5 |
27 |
--------------------------------------------------------------------------------
/chapter1/Semantics.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringReact3rdBatch/2b04370d84c790bd64ceeba979194fdc467d3ece/chapter1/Semantics.class
--------------------------------------------------------------------------------
/chapter1/Semantics.java:
--------------------------------------------------------------------------------
1 | class Semantics
2 | {
3 | public static void main(String[]args)
4 | {
5 | int result = 5/2;
6 | System.out.println("Result "+result);
7 |
8 | int a = 5;
9 | a = "Hello";
10 | }
11 | }
--------------------------------------------------------------------------------
/chapter1/Sematics.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringReact3rdBatch/2b04370d84c790bd64ceeba979194fdc467d3ece/chapter1/Sematics.class
--------------------------------------------------------------------------------
/chapter1/backend.js:
--------------------------------------------------------------------------------
1 | let a = 10;
2 | a ++;
3 | console.log("A is a ",a);
--------------------------------------------------------------------------------
/chapter1/demo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringReact3rdBatch/2b04370d84c790bd64ceeba979194fdc467d3ece/chapter1/demo
--------------------------------------------------------------------------------
/chapter1/demo.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "fmt"
4 |
5 | func main() {
6 | fmt.Println("hello")
7 | }
8 |
--------------------------------------------------------------------------------
/chapter1/demo.js:
--------------------------------------------------------------------------------
1 | var a = "10";
2 | a = "Hello";
3 | console.log("A is ", a + 3);
4 | var b = "hello";
5 | b = false;
6 | var str = "Hello";
7 | //srt = "Ok";
8 | console.log(str);
9 |
--------------------------------------------------------------------------------
/chapter1/demo.ts:
--------------------------------------------------------------------------------
1 | let a:string = "10";
2 | a = "Hello";
3 | console.log("A is ",a + 3);
4 |
5 | let b:any ="hello";
6 | b = false;
7 |
8 | let str = "Hello";
9 | //srt = "Ok";
10 | console.log(str);
--------------------------------------------------------------------------------
/chapter1/tempCodeRunnerFile.go:
--------------------------------------------------------------------------------
1 | fmt.Println("hello")
--------------------------------------------------------------------------------
/chapter10/Module.html:
--------------------------------------------------------------------------------
1 |
2 |
16 |
--------------------------------------------------------------------------------
/chapter10/MyNodeModule.js:
--------------------------------------------------------------------------------
1 | console.log("Module initialized");
2 | const method = ()=>console.log("Module Method");
3 |
4 | exports.api = method;
--------------------------------------------------------------------------------
/chapter10/UseEs6.html:
--------------------------------------------------------------------------------
1 |
2 |
5 |
--------------------------------------------------------------------------------
/chapter10/es6_module.js:
--------------------------------------------------------------------------------
1 | console.log("Module initialized");
2 | export const api = ()=>console.log("Module Method");
--------------------------------------------------------------------------------
/chapter10/use_module.js:
--------------------------------------------------------------------------------
1 | const myModule = require("./MyNodeModule");
2 | const myModule2 = require("./MyNodeModule");
3 | myModule.api();
--------------------------------------------------------------------------------
/chapter11/Date.html:
--------------------------------------------------------------------------------
1 |
2 |
5 |
25 |
--------------------------------------------------------------------------------
/chapter11/Endian.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
19 |
--------------------------------------------------------------------------------
/chapter11/Error.html:
--------------------------------------------------------------------------------
1 |
2 |
5 |
22 |
--------------------------------------------------------------------------------
/chapter11/EventLoop.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
20 |
--------------------------------------------------------------------------------
/chapter11/JSON.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
29 |
--------------------------------------------------------------------------------
/chapter11/ParseDate.html:
--------------------------------------------------------------------------------
1 |
2 |
5 |
20 |
--------------------------------------------------------------------------------
/chapter11/RE3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
--------------------------------------------------------------------------------
/chapter11/RE_email.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
--------------------------------------------------------------------------------
/chapter11/RegExp.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
--------------------------------------------------------------------------------
/chapter11/Set.html:
--------------------------------------------------------------------------------
1 |
2 |
26 |
--------------------------------------------------------------------------------
/chapter11/Sticky.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
--------------------------------------------------------------------------------
/chapter11/Timer.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
21 |
--------------------------------------------------------------------------------
/chapter11/URLDemo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
19 |
--------------------------------------------------------------------------------
/chapter11/WeakMap.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
22 |
--------------------------------------------------------------------------------
/chapter12/Generator.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
25 |
--------------------------------------------------------------------------------
/chapter12/GeneratorTwo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
27 |
--------------------------------------------------------------------------------
/chapter12/Iterator.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
24 |
--------------------------------------------------------------------------------
/chapter12/python_loop.py:
--------------------------------------------------------------------------------
1 | for x in range(0, 3):
2 | print("We're on time %d" % (x))
--------------------------------------------------------------------------------
/chapter13/Async2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
28 |
--------------------------------------------------------------------------------
/chapter13/AsyncAwat.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
23 |
--------------------------------------------------------------------------------
/chapter13/AsyncRead.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs')
2 |
3 | console.log("Before read");
4 | fs.readFile('AsyncRead.js', 'utf8' , (err, data) => {
5 | if (err) {
6 | console.error(err)
7 | return
8 | }
9 | console.log("Data Completed: >>",data);
10 | });
11 | console.log("after read API");
--------------------------------------------------------------------------------
/chapter13/Event.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
32 |
--------------------------------------------------------------------------------
/chapter13/Fetch.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
--------------------------------------------------------------------------------
/chapter13/FetchTwo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
27 |
--------------------------------------------------------------------------------
/chapter13/GetUrl.js:
--------------------------------------------------------------------------------
1 | const https = require('https')
2 | function getUrl(url)
3 | {
4 | let request = https.get(url);
5 | //console.log("Request ",request);
6 | request.on("response",(response)=>{
7 | //console.log("Response ",response);
8 | response.setEncoding("utf-8");
9 | let data = "";
10 | response.on("data",(chunk)=>{
11 | console.log("Data event");
12 | data+= chunk;
13 | });
14 | response.on("end",()=>{
15 | console.log("End event");
16 | console.log("Data ",data);
17 | });
18 | });
19 |
20 | }
21 | let url = "https://jsonplaceholder.typicode.com/todos/1";
22 | getUrl(url);
--------------------------------------------------------------------------------
/chapter13/Promise.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
19 |
--------------------------------------------------------------------------------
/chapter13/Promise2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
23 |
--------------------------------------------------------------------------------
/chapter13/PromiseAll.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
22 |
--------------------------------------------------------------------------------
/chapter13/PromiseErrorHandling.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
25 |
--------------------------------------------------------------------------------
/chapter13/SequentialPromise.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
19 |
--------------------------------------------------------------------------------
/chapter13/SyncRead.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs')
2 |
3 | try {
4 | console.log("Before read");
5 | const data = fs.readFileSync('SyncRead.js', 'utf8')
6 | console.log("File read completed>>",data);
7 | } catch (err) {
8 | console.error(err)
9 | }
10 |
--------------------------------------------------------------------------------
/chapter14/ClassType.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
--------------------------------------------------------------------------------
/chapter14/CustomArray.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
31 |
--------------------------------------------------------------------------------
/chapter14/CustomMatch.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
24 |
--------------------------------------------------------------------------------
/chapter14/DynamicInheritance.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
29 |
--------------------------------------------------------------------------------
/chapter14/MetaProgram.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
31 |
--------------------------------------------------------------------------------
/chapter14/Prototype.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
20 |
--------------------------------------------------------------------------------
/chapter14/Seal.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
25 |
--------------------------------------------------------------------------------
/chapter14/Symbol.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
19 |
--------------------------------------------------------------------------------
/chapter14/Template.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
29 |
--------------------------------------------------------------------------------
/chapter15/Another2.js:
--------------------------------------------------------------------------------
1 |
2 | console.log("Another 2 loaded");
--------------------------------------------------------------------------------
/chapter15/Closest.html:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 | one
13 | |
14 |
15 |
16 |
17 | Two
18 | |
19 |
20 |
21 |
22 | Three
23 | |
24 |
25 |
26 |
27 |
28 |
29 |
38 |
39 |
--------------------------------------------------------------------------------
/chapter15/Error.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
15 |
23 |
24 |
--------------------------------------------------------------------------------
/chapter15/EventReturn.html:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
12 |
13 |
14 |
15 |
23 |
24 |
--------------------------------------------------------------------------------
/chapter15/Global.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
17 |
20 |
23 |
24 |
--------------------------------------------------------------------------------
/chapter15/LazyLoad.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
25 |
26 |
--------------------------------------------------------------------------------
/chapter15/MessageChannel.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
12 |
13 |
--------------------------------------------------------------------------------
/chapter15/Selector.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Hello
5 | Hello2
6 |
7 |
8 | Div
9 |
10 |
11 |
12 |
26 |
27 |
--------------------------------------------------------------------------------
/chapter15/Storage.html:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
28 |
29 |
--------------------------------------------------------------------------------
/chapter15/Timer.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Time Hello
4 |
6 |
7 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/chapter15/WorkerThread.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
--------------------------------------------------------------------------------
/chapter15/XSSDemo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello
4 |
5 |
8 |
9 |
10 |
11 |
24 |
--------------------------------------------------------------------------------
/chapter15/another.js:
--------------------------------------------------------------------------------
1 |
2 | console.log("Document fully loaded");
--------------------------------------------------------------------------------
/chapter15/async.js:
--------------------------------------------------------------------------------
1 |
2 | console.log("Async loaded");
--------------------------------------------------------------------------------
/chapter15/clock.js:
--------------------------------------------------------------------------------
1 | let time = document.querySelector("#time");
2 |
3 | function currentTime()
4 | {
5 | time.textContent = new Date().toLocaleTimeString();
6 | }
7 | setInterval(currentTime,1000);
8 | console.log("Script executed");
--------------------------------------------------------------------------------
/chapter15/lib.js:
--------------------------------------------------------------------------------
1 | console.log("Data in lib", data);
2 | hello();
--------------------------------------------------------------------------------
/chapter15/module.js:
--------------------------------------------------------------------------------
1 | +function ()
2 | {
3 | console.log("Module code");
4 | }();
--------------------------------------------------------------------------------
/chapter15/worker.js:
--------------------------------------------------------------------------------
1 | function factorial(num)
2 | {
3 | if(num ==0)
4 | {
5 | return 1;
6 | }
7 | else
8 | {
9 | return num * factorial(num-1);
10 | }
11 | }
12 | onmessage = function(e)
13 | {
14 | console.log("meessage received ",e.data);
15 | let result = factorial(e.data);
16 | postMessage(result);
17 | }
--------------------------------------------------------------------------------
/chapter16/Buffer.js:
--------------------------------------------------------------------------------
1 | let b = Buffer.from([0x41, 0x42, 0x43]);
2 | console.log("b.toString ",b.toString());
3 |
4 | console.log("b.toString('hex') ",b.toString('hex'));
5 |
6 | let zeros = Buffer.alloc(1024);
7 | let ones = Buffer.alloc(1024,1);
8 |
9 | let dead = Buffer.alloc(1024, "DEADBEEF", "hex");
10 | console.log("Unsigned BE",dead.readUInt32BE(0));
11 | console.log("Unsigned LE",dead.readUInt32LE(0));
--------------------------------------------------------------------------------
/chapter16/CopyFile.js:
--------------------------------------------------------------------------------
1 | const fs = require("fs");
2 | function copyFile(sourceFile,destinationFile,callback)
3 | {
4 | fs.readFile(sourceFile,(err,buffer)=>{
5 | if(err)
6 | {
7 | callback(err);
8 | }
9 | else
10 | {
11 | fs.writeFile(destinationFile,buffer,callback);
12 | }
13 | });
14 | }
15 | copyFile('hello.txt','copy.txt',(e)=>console.log('callback e is',e))
--------------------------------------------------------------------------------
/chapter16/EventEmitterDemo.js:
--------------------------------------------------------------------------------
1 | const events = require('events');
2 | const emitter = new events.EventEmitter();
3 |
4 | emitter.on("JustOnce",(event)=>{
5 | console.log("JustOnce Event ",event);
6 | })
7 | emitter.on("someEvent",(event)=>{
8 | console.log("Event ",event);
9 | })
10 | emitter.emit("someEvent",{
11 | data: "SomeEvent occurs"
12 | });
13 |
14 | emitter.emit("JustOnce",{
15 | data: "JustOnce occurs"
16 | });
17 |
--------------------------------------------------------------------------------
/chapter16/Hello.js:
--------------------------------------------------------------------------------
1 | console.log("Hello World");
2 | console.log("Argv ",process.argv);
3 | console.log("Env ",process.env);
--------------------------------------------------------------------------------
/chapter16/PipeDemo.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs')
2 |
3 | var readable = fs.createReadStream('hello.txt')
4 | var writable = fs.createWriteStream('pipe.txt')
5 |
6 | readable.pipe(writable) // returns writable
--------------------------------------------------------------------------------
/chapter16/StreamDemo.js:
--------------------------------------------------------------------------------
1 | const http = require('http');
2 |
3 | const server = http.createServer((req, res) => {
4 | // `req` is an http.IncomingMessage, which is a readable stream.
5 | // `res` is an http.ServerResponse, which is a writable stream.
6 |
7 | let body = '';
8 | // Get the data as utf8 strings.
9 | // If an encoding is not set, Buffer objects will be received.
10 | req.setEncoding('utf8');
11 |
12 | // Readable streams emit 'data' events once a listener is added.
13 | req.on('data', (chunk) => {
14 | body += chunk;
15 | });
16 |
17 | // The 'end' event indicates that the entire body has been received.
18 | req.on('end', () => {
19 | try {
20 | console.log("body ",body);
21 | const data = JSON.stringify({text:"Hello"});
22 | // Write back something interesting to the user:
23 | res.write(data);
24 | res.end();
25 | } catch (er) {
26 | // uh oh! bad json!
27 | res.statusCode = 400;
28 | return res.end(`error: ${er.message}`);
29 | }
30 | });
31 | });
32 |
33 | server.listen(1337);
--------------------------------------------------------------------------------
/chapter16/async.js:
--------------------------------------------------------------------------------
1 | const axios = require('axios')
2 |
3 | const fetchUrl = async (url)=>{
4 | let response = await axios.get(url);
5 | let data = await response.data;
6 | //console.log('Response.data ',response.data);
7 | return data;
8 | }
9 | let url = 'https://jsonplaceholder.typicode.com/posts/1';
10 | let response = fetchUrl(url);
11 | //response.then(data=>console.log("Data is ",data))
12 |
13 | const forAwait = async()=>{
14 | let arr = [fetchUrl('https://jsonplaceholder.typicode.com/posts/1'),
15 | fetchUrl('https://jsonplaceholder.typicode.com/posts/2')]
16 |
17 | for await( let data of arr)
18 | {
19 | console.log("for await Data ",data);
20 | }
21 | };
22 | forAwait();
23 |
--------------------------------------------------------------------------------
/chapter16/axios_call.js:
--------------------------------------------------------------------------------
1 | const axios = require('axios')
2 |
3 | axios
4 | .get('https://jsonplaceholder.typicode.com/posts/1')
5 | .then(res => {
6 | console.log(`statusCode: ${res.status}`)
7 | console.log(res.data)
8 | })
9 | .catch(error => {
10 | console.error(error)
11 | })
--------------------------------------------------------------------------------
/chapter16/copy.txt:
--------------------------------------------------------------------------------
1 | hello
--------------------------------------------------------------------------------
/chapter16/hello.txt:
--------------------------------------------------------------------------------
1 | hello
--------------------------------------------------------------------------------
/chapter16/hello.txt.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringReact3rdBatch/2b04370d84c790bd64ceeba979194fdc467d3ece/chapter16/hello.txt.gz
--------------------------------------------------------------------------------
/chapter16/httpRequest.txt:
--------------------------------------------------------------------------------
1 | GET / HTTP/1.1
2 | Host: localhost:9000
3 | Connection: keep-alive
4 | sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="99", "Google Chrome";v="99"
5 | sec-ch-ua-mobile: ?0
6 | sec-ch-ua-platform: "macOS"
7 | Upgrade-Insecure-Requests: 1
8 | User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36
9 | Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
10 | Sec-Fetch-Site: none
11 | Sec-Fetch-Mode: navigate
12 | Sec-Fetch-User: ?1
13 | Sec-Fetch-Dest: document
14 | Accept-Encoding: gzip, deflate, br
15 | Accept-Language: en-US,en;q=0.9
16 | Cookie: JSESSIONID=545C694A1CD1B4EB0B6CC4BBB32DAD52; __openmrs_language=en; apollo-server-landing-page-redirect-to-studio-local=false
17 |
--------------------------------------------------------------------------------
/chapter16/pipe.txt:
--------------------------------------------------------------------------------
1 | hello
--------------------------------------------------------------------------------
/chapter16/promisify.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 | const { promisify } = require('util');
3 | const readFile = promisify(fs.readFile);
4 | const writeFile = promisify(fs.writeFile);
5 | /*
6 | fs.readFile('transform.js',(err,data)=>{
7 | console.log("Data ",data.toString());
8 | });
9 | */
10 | readFile('transform.js')
11 | .then(data=>console.log("data is ",data.toString()))
--------------------------------------------------------------------------------
/chapter16/rest_call.js:
--------------------------------------------------------------------------------
1 | const https = require('https');
2 | const url = "https://jsonplaceholder.typicode.com/posts/1";
3 |
4 | https.get(url, res => {
5 | res.setEncoding("utf8");
6 | let body = "";
7 | res.on("data", data => {
8 | body += data;
9 | });
10 | res.on("end", () => {
11 | body = JSON.parse(body);
12 | console.log(body);
13 | });
14 | })
--------------------------------------------------------------------------------
/chapter16/tcp_server.js:
--------------------------------------------------------------------------------
1 | const net = require('net')
2 |
3 | let server = net.createServer();
4 | let handleConnection = (con)=>{
5 | con.on('data',(data)=>{
6 | console.log("Data ",data.toString());
7 |
8 | let responseStatus ="HTTP/1.1 200 Ok\r\n";
9 | let responseBody = "Hello From Server
";
10 | responseStatus +="Content-Type:text/html\r\n";
11 | responseStatus +=`Content-Length:${responseBody.length}\r\n\r\n`;
12 | con.write(responseStatus);
13 | con.write(responseBody);
14 | //con.close();
15 | });
16 | }
17 | server.on("connection",handleConnection);
18 |
19 |
20 | server.listen(9000,()=>console.log("server started"));
--------------------------------------------------------------------------------
/chapter16/tempCodeRunnerFile.js:
--------------------------------------------------------------------------------
1 | 9000
--------------------------------------------------------------------------------
/chapter16/transform.js:
--------------------------------------------------------------------------------
1 | const fs = require("fs");
2 | const zlib = require("zlib");
3 |
4 | function gzip(filename, callback) {
5 | // Create the streams
6 | let source = fs.createReadStream(filename);
7 | let destination = fs.createWriteStream(filename + ".gz");
8 | let gzipper = zlib.createGzip();
9 |
10 | source.on("error", callback)
11 | .pipe(gzipper)
12 | .pipe(destination)
13 | .on("error", callback)
14 | .on("finish", callback); // call callback when writing is complete
15 | }
16 |
17 | gzip('hello.txt', ()=>console.log("Done"))
--------------------------------------------------------------------------------
/chapter16/web_server.js:
--------------------------------------------------------------------------------
1 | const http = require("http");
2 |
3 | const requestListener = (req,res)=>{
4 | console.log("Req ",req.headers);
5 | //res.setHeader('Content-Type', 'text/plain');
6 | let obj = {
7 | text:"Hello"
8 | };
9 | res.setHeader('Content-Type', 'application/json');
10 | res.writeHead(200);
11 | res.end(JSON.stringify(obj));
12 | };
13 |
14 | const server = http.createServer(requestListener);
15 | server.listen(9000,()=>console.log('Server started'));
--------------------------------------------------------------------------------
/chapter2/NaN.html:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/chapter2/demo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringReact3rdBatch/2b04370d84c790bd64ceeba979194fdc467d3ece/chapter2/demo
--------------------------------------------------------------------------------
/chapter2/demo.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "fmt"
4 |
5 | func main() {
6 | x := 3 / 2
7 | fmt.Println("hello ", x)
8 | }
9 |
--------------------------------------------------------------------------------
/chapter2/iteral.html:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/chapter2/lexical.html:
--------------------------------------------------------------------------------
1 |
2 |
17 |
--------------------------------------------------------------------------------
/chapter2/line_break.py:
--------------------------------------------------------------------------------
1 | def hello():
2 | print("Hello")
3 | print("how are you")
4 | hello()
--------------------------------------------------------------------------------
/chapter2/number.html:
--------------------------------------------------------------------------------
1 |
2 |
29 |
--------------------------------------------------------------------------------
/chapter2/optionalSemicolon.html:
--------------------------------------------------------------------------------
1 |
2 |
20 |
--------------------------------------------------------------------------------
/chapter2/zero.html:
--------------------------------------------------------------------------------
1 |
2 |
18 |
--------------------------------------------------------------------------------
/chapter3/Arithmetic.html:
--------------------------------------------------------------------------------
1 |
2 |
23 |
--------------------------------------------------------------------------------
/chapter3/Boolean.html:
--------------------------------------------------------------------------------
1 |
2 |
17 |
--------------------------------------------------------------------------------
/chapter3/DateTime.html:
--------------------------------------------------------------------------------
1 |
2 |
8 |
--------------------------------------------------------------------------------
/chapter3/Destructuring.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
--------------------------------------------------------------------------------
/chapter3/Equality.html:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/chapter3/FloatingPoint.html:
--------------------------------------------------------------------------------
1 |
2 |
12 |
--------------------------------------------------------------------------------
/chapter3/Global.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
--------------------------------------------------------------------------------
/chapter3/LetConst.html:
--------------------------------------------------------------------------------
1 |
2 |
13 |
--------------------------------------------------------------------------------
/chapter3/LetvsVar.html:
--------------------------------------------------------------------------------
1 |
2 |
29 |
--------------------------------------------------------------------------------
/chapter3/MutableImmutable.html:
--------------------------------------------------------------------------------
1 |
2 |
20 |
--------------------------------------------------------------------------------
/chapter3/NullAndUndefined.html:
--------------------------------------------------------------------------------
1 |
2 |
15 |
--------------------------------------------------------------------------------
/chapter3/ObjToBoolean.html:
--------------------------------------------------------------------------------
1 |
2 |
14 |
--------------------------------------------------------------------------------
/chapter3/ObjectToString.html:
--------------------------------------------------------------------------------
1 |
2 |
20 |
--------------------------------------------------------------------------------
/chapter3/ParseInt.html:
--------------------------------------------------------------------------------
1 |
2 |
12 |
--------------------------------------------------------------------------------
/chapter3/TypeConversion.html:
--------------------------------------------------------------------------------
1 |
2 |
12 |
--------------------------------------------------------------------------------
/chapter3/UndeclaredVar.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
25 |
--------------------------------------------------------------------------------
/chapter3/ValueRef.html:
--------------------------------------------------------------------------------
1 |
2 |
29 |
--------------------------------------------------------------------------------
/chapter3/string_demo.html:
--------------------------------------------------------------------------------
1 |
2 |
20 |
--------------------------------------------------------------------------------
/chapter3/template.html:
--------------------------------------------------------------------------------
1 |
2 |
12 |
--------------------------------------------------------------------------------
/chapter3/variable.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "fmt"
4 |
5 | func main() {
6 | var x int
7 | x = 3
8 | fmt.Println("hello ", x)
9 |
10 | //x = "Hello"
11 | }
12 |
--------------------------------------------------------------------------------
/chapter4/Arithmetic.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
--------------------------------------------------------------------------------
/chapter4/Assignment.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 |
--------------------------------------------------------------------------------
/chapter4/Bitwise.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
--------------------------------------------------------------------------------
/chapter4/ConditionalOp.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
--------------------------------------------------------------------------------
/chapter4/Delete.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
--------------------------------------------------------------------------------
/chapter4/Eval.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/chapter4/Expression.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 |
--------------------------------------------------------------------------------
/chapter4/FirstDefined.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
17 |
--------------------------------------------------------------------------------
/chapter4/In.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
--------------------------------------------------------------------------------
/chapter4/Increment.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
14 |
--------------------------------------------------------------------------------
/chapter4/InstanceOf.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
--------------------------------------------------------------------------------
/chapter4/Precedence.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
--------------------------------------------------------------------------------
/chapter4/Relational.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
28 |
--------------------------------------------------------------------------------
/chapter4/Subtraction.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
--------------------------------------------------------------------------------
/chapter4/TypeOf.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
--------------------------------------------------------------------------------
/chapter4/comparison.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
26 |
--------------------------------------------------------------------------------
/chapter4/division.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "fmt"
4 |
5 | func main() {
6 | var a int
7 | a = 5
8 | b := 2
9 |
10 | fmt.Println("hello ", a/b)
11 |
12 | //x = "Hello"
13 | }
14 |
--------------------------------------------------------------------------------
/chapter4/void.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
12 |
--------------------------------------------------------------------------------
/chapter5/Break.html:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
--------------------------------------------------------------------------------
/chapter5/Conditional.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
22 |
--------------------------------------------------------------------------------
/chapter5/Continue.html:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
--------------------------------------------------------------------------------
/chapter5/DangliingElse.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
--------------------------------------------------------------------------------
/chapter5/DivWithMultipleReturn.html:
--------------------------------------------------------------------------------
1 |
2 |
31 |
32 |
--------------------------------------------------------------------------------
/chapter5/DoWhile.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
--------------------------------------------------------------------------------
/chapter5/ElseIf.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 |
--------------------------------------------------------------------------------
/chapter5/ExpressionStatement.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
--------------------------------------------------------------------------------
/chapter5/Finally.html:
--------------------------------------------------------------------------------
1 |
2 |
40 |
41 |
--------------------------------------------------------------------------------
/chapter5/For.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
28 |
--------------------------------------------------------------------------------
/chapter5/ForIn.html:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/chapter5/ForOfMap.html:
--------------------------------------------------------------------------------
1 |
2 |
25 |
26 |
--------------------------------------------------------------------------------
/chapter5/LabelBreak.html:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
--------------------------------------------------------------------------------
/chapter5/Loop.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
14 |
--------------------------------------------------------------------------------
/chapter5/NewObject.html:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/chapter5/Object.html:
--------------------------------------------------------------------------------
1 |
2 |
23 |
24 |
--------------------------------------------------------------------------------
/chapter5/ObjectCreate.html:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
--------------------------------------------------------------------------------
/chapter5/SwithProblem.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
37 |
--------------------------------------------------------------------------------
/chapter5/Throw.html:
--------------------------------------------------------------------------------
1 |
2 |
31 |
32 |
--------------------------------------------------------------------------------
/chapter5/UseStrict.html:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
--------------------------------------------------------------------------------
/chapter5/With.html:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
--------------------------------------------------------------------------------
/chapter5/jump.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "fmt"
4 |
5 | func main() {
6 |
7 | x := 0
8 | label:
9 | fmt.Println("hello ")
10 | fmt.Println("Hello 2")
11 | x = x + 1
12 | if x < 5 {
13 | goto label
14 | } else {
15 | goto another
16 | }
17 | fmt.Println("Never printed")
18 | another:
19 | fmt.Println("Another label")
20 | //goto label
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/chapter5/multiple_ret.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "fmt"
4 |
5 | func div(x int, y int) (int, int) {
6 | if y == 0 {
7 | return 1, 0
8 | } else {
9 | return 0, x / y
10 | }
11 |
12 | }
13 |
14 | func main() {
15 |
16 | error, result := div(12, 2)
17 | if error != 1 {
18 | fmt.Println("Result ", result)
19 | } else {
20 | fmt.Println("Division by zero ")
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/chapter5/return.html:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
--------------------------------------------------------------------------------
/chapter5/tempCodeRunnerFile.go:
--------------------------------------------------------------------------------
1 | label
--------------------------------------------------------------------------------
/chapter6/AssociatveArray.html:
--------------------------------------------------------------------------------
1 |
2 |
33 |
34 |
--------------------------------------------------------------------------------
/chapter6/ExtendObjectLiteral.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
--------------------------------------------------------------------------------
/chapter6/Method.html:
--------------------------------------------------------------------------------
1 |
2 |
23 |
24 |
--------------------------------------------------------------------------------
/chapter6/ObjectCreate.html:
--------------------------------------------------------------------------------
1 |
2 |
31 |
32 |
--------------------------------------------------------------------------------
/chapter6/ObjectProperty.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
--------------------------------------------------------------------------------
/chapter6/Of.html:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
--------------------------------------------------------------------------------
/chapter6/Serialization.html:
--------------------------------------------------------------------------------
1 |
2 |
36 |
37 |
--------------------------------------------------------------------------------
/chapter6/enumerate.html:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
--------------------------------------------------------------------------------
/chapter6/extend.html:
--------------------------------------------------------------------------------
1 |
2 |
25 |
26 |
--------------------------------------------------------------------------------
/chapter7/AddRemove.html:
--------------------------------------------------------------------------------
1 |
2 |
40 |
41 |
--------------------------------------------------------------------------------
/chapter7/Array.html:
--------------------------------------------------------------------------------
1 |
2 |
28 |
29 |
--------------------------------------------------------------------------------
/chapter7/ArrayLikeObj.html:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
--------------------------------------------------------------------------------
/chapter7/ArrayMethod.html:
--------------------------------------------------------------------------------
1 |
2 |
25 |
26 |
--------------------------------------------------------------------------------
/chapter7/ArrayOfArray.html:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
--------------------------------------------------------------------------------
/chapter7/ArraySearch.html:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
--------------------------------------------------------------------------------
/chapter7/Concat.html:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
--------------------------------------------------------------------------------
/chapter7/CopyWithin.html:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
--------------------------------------------------------------------------------
/chapter7/CreateArray.html:
--------------------------------------------------------------------------------
1 |
2 |
38 |
39 |
--------------------------------------------------------------------------------
/chapter7/Every.html:
--------------------------------------------------------------------------------
1 |
2 |
28 |
29 |
--------------------------------------------------------------------------------
/chapter7/Filter.html:
--------------------------------------------------------------------------------
1 |
2 |
32 |
33 |
--------------------------------------------------------------------------------
/chapter7/Flat.html:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
--------------------------------------------------------------------------------
/chapter7/ForEachForMultiArray.html:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
--------------------------------------------------------------------------------
/chapter7/HetrogenousArray.html:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/chapter7/Map.html:
--------------------------------------------------------------------------------
1 |
2 |
36 |
37 |
--------------------------------------------------------------------------------
/chapter7/ReadWrite.html:
--------------------------------------------------------------------------------
1 |
2 |
34 |
35 |
--------------------------------------------------------------------------------
/chapter7/Reduce.html:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
--------------------------------------------------------------------------------
/chapter7/ReduceExample.html:
--------------------------------------------------------------------------------
1 |
2 |
26 |
27 |
--------------------------------------------------------------------------------
/chapter7/Slice.html:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
--------------------------------------------------------------------------------
/chapter7/Sort.html:
--------------------------------------------------------------------------------
1 |
2 |
42 |
43 |
--------------------------------------------------------------------------------
/chapter7/Splice.html:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
--------------------------------------------------------------------------------
/chapter7/StringAsArray.html:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/chapter8/Apply.html:
--------------------------------------------------------------------------------
1 |
2 |
33 |
34 |
--------------------------------------------------------------------------------
/chapter8/Argument.html:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
--------------------------------------------------------------------------------
/chapter8/CallApply.html:
--------------------------------------------------------------------------------
1 |
2 |
24 |
25 |
--------------------------------------------------------------------------------
/chapter8/CheckArgument.html:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
--------------------------------------------------------------------------------
/chapter8/Destructuring.html:
--------------------------------------------------------------------------------
1 |
2 |
26 |
27 |
--------------------------------------------------------------------------------
/chapter8/FirstClass.html:
--------------------------------------------------------------------------------
1 |
2 |
27 |
28 |
--------------------------------------------------------------------------------
/chapter8/Function.html:
--------------------------------------------------------------------------------
1 |
2 |
33 |
34 |
--------------------------------------------------------------------------------
/chapter8/FunctionCont.html:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/chapter8/FunctionLength.html:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
--------------------------------------------------------------------------------
/chapter8/FunctionProperty.html:
--------------------------------------------------------------------------------
1 |
2 |
25 |
26 |
--------------------------------------------------------------------------------
/chapter8/Invocation.html:
--------------------------------------------------------------------------------
1 |
2 |
25 |
26 |
--------------------------------------------------------------------------------
/chapter8/LongParameterAsObject.html:
--------------------------------------------------------------------------------
1 |
2 |
24 |
25 |
--------------------------------------------------------------------------------
/chapter8/Module.html:
--------------------------------------------------------------------------------
1 |
2 |
24 |
25 |
--------------------------------------------------------------------------------
/chapter8/NestedFunction.html:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
--------------------------------------------------------------------------------
/chapter8/Parameter.html:
--------------------------------------------------------------------------------
1 |
2 |
27 |
28 |
--------------------------------------------------------------------------------
/chapter8/Private.html:
--------------------------------------------------------------------------------
1 |
2 |
22 |
23 |
--------------------------------------------------------------------------------
/chapter8/RestParameter.html:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
--------------------------------------------------------------------------------
/chapter8/parallel_assignment.py:
--------------------------------------------------------------------------------
1 | x = 10
2 | y = 20
3 | x,y = y,x
4 | print("x is ",x)
5 | print("y is ",y)
--------------------------------------------------------------------------------
/chapter9/Composition.html:
--------------------------------------------------------------------------------
1 |
2 |
34 |
--------------------------------------------------------------------------------
/chapter9/CompositionTwo.html:
--------------------------------------------------------------------------------
1 |
2 |
37 |
--------------------------------------------------------------------------------
/chapter9/ExtendNativeObject.html:
--------------------------------------------------------------------------------
1 |
2 |
24 |
--------------------------------------------------------------------------------
/chapter9/Extension.html:
--------------------------------------------------------------------------------
1 |
2 |
24 |
--------------------------------------------------------------------------------
/chapter9/GetterSetter.html:
--------------------------------------------------------------------------------
1 |
2 |
34 |
--------------------------------------------------------------------------------
/chapter9/Inheritance.html:
--------------------------------------------------------------------------------
1 |
2 |
36 |
--------------------------------------------------------------------------------
/chapter9/Private.html:
--------------------------------------------------------------------------------
1 |
2 |
35 |
--------------------------------------------------------------------------------
/fp/Combinator.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/fp/Compose.fsx:
--------------------------------------------------------------------------------
1 | let toUpper (str:string) = str.ToUpper()
2 | let appendHi (str:string) = str + " Hi"
3 | let third = toUpper >> appendHi
4 | printfn "%s " (third "Hello World from F#!!")
5 |
6 | let fourth str = str |> toUpper |> appendHi
7 | printfn "%s " (fourth "test")
--------------------------------------------------------------------------------
/fp/Currying.fsx:
--------------------------------------------------------------------------------
1 |
2 | let add x y = x + y
3 | let addTwo = add 2
4 | printfn "%d " (addTwo 3)
5 | 0 // return an integer exit code
6 |
--------------------------------------------------------------------------------
/fp/Currying.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
34 |
35 |
--------------------------------------------------------------------------------
/fp/CurryingUtil.html:
--------------------------------------------------------------------------------
1 |
2 |
31 |
32 |
--------------------------------------------------------------------------------
/fp/CustomFilter.html:
--------------------------------------------------------------------------------
1 |
2 |
28 |
29 |
--------------------------------------------------------------------------------
/fp/FPDemo.fsx:
--------------------------------------------------------------------------------
1 |
2 | printfn "Hello World from F#!!"
3 | let data = 20
4 | printfn "Hello World from F#!!"
5 | data = 120
6 | printfn "%d" data
7 | 0 // return an integer exit code
8 |
--------------------------------------------------------------------------------
/fp/FilterWithReduce.html:
--------------------------------------------------------------------------------
1 |
2 |
25 |
26 |
--------------------------------------------------------------------------------
/fp/FlatMap.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/fp/ForkJoin.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/fp/HigherOrder.html:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
--------------------------------------------------------------------------------
/fp/MethodChaining.html:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/fp/Monad.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/fp/PlainJSVersion.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/fp/Pure.html:
--------------------------------------------------------------------------------
1 |
2 |
25 |
26 |
--------------------------------------------------------------------------------
/fp/RailwayOrientedProgramming.html:
--------------------------------------------------------------------------------
1 |
2 |
25 |
26 |
--------------------------------------------------------------------------------
/fp/RamdaCompose.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
14 |
15 |
--------------------------------------------------------------------------------
/fp/SequenceCombinator.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/fp/Wrapper.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/fp/pipe.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
--------------------------------------------------------------------------------
/frontend/.idea/frontend.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/frontend/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/frontend/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/frontend/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/frontend/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringReact3rdBatch/2b04370d84c790bd64ceeba979194fdc467d3ece/frontend/public/favicon.ico
--------------------------------------------------------------------------------
/frontend/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringReact3rdBatch/2b04370d84c790bd64ceeba979194fdc467d3ece/frontend/public/logo192.png
--------------------------------------------------------------------------------
/frontend/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringReact3rdBatch/2b04370d84c790bd64ceeba979194fdc467d3ece/frontend/public/logo512.png
--------------------------------------------------------------------------------
/frontend/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/frontend/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/frontend/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | pointer-events: none;
8 | }
9 |
10 | @media (prefers-reduced-motion: no-preference) {
11 | .App-logo {
12 | animation: App-logo-spin infinite 20s linear;
13 | }
14 | }
15 |
16 | .App-header {
17 | background-color: #282c34;
18 | /*min-height: 100vh;*/
19 | display: flex;
20 | flex-direction: column;
21 | align-items: center;
22 | justify-content: center;
23 | font-size: calc(10px + 2vmin);
24 | color: white;
25 | }
26 |
27 | .App-link {
28 | color: #61dafb;
29 | }
30 |
31 | @keyframes App-logo-spin {
32 | from {
33 | transform: rotate(0deg);
34 | }
35 | to {
36 | transform: rotate(360deg);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/frontend/src/App.test.js:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import App from './App';
3 |
4 | test('renders learn react link', () => {
5 | render();
6 | const linkElement = screen.getByText(/learn react/i);
7 | expect(linkElement).toBeInTheDocument();
8 | });
9 |
--------------------------------------------------------------------------------
/frontend/src/app/store.js:
--------------------------------------------------------------------------------
1 | import { configureStore } from '@reduxjs/toolkit'
2 | import counterReducer from '../features/counter/counterSlice';
3 | import toDoReducer from '../features/todo/toDoSlice';
4 | import movieReducer from '../features/movie-list/movieSlice';
5 | import reviewReducer from '../features/review/reviewSlice';
6 |
7 | export default configureStore({
8 | reducer: {
9 | counter: counterReducer,
10 | toDo: toDoReducer,
11 | movie: movieReducer,
12 | review : reviewReducer,
13 | },
14 | })
--------------------------------------------------------------------------------
/frontend/src/components/AcceptComponent.js:
--------------------------------------------------------------------------------
1 | function AcceptComponent(props) {
2 | //props.child = Something
3 | return(
4 |
5 |
6 | Accept Component
7 |
8 |
9 |
10 | Child
11 | {props.child}
12 |
13 |
14 |
15 | );
16 | }
17 | export default AcceptComponent;
--------------------------------------------------------------------------------
/frontend/src/components/DefaultProperty.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import PropTypes from 'prop-types';
3 |
4 | class DefaultProperty extends React.Component
5 | {
6 | constructor(props) {
7 | super(props);
8 |
9 | }
10 | render() {
11 | console.log('This.props ',this.props);
12 | return (
13 |
{this.props.title}
14 | );
15 | }
16 | }
17 | DefaultProperty.defaultProps ={
18 | title:'Default Title'
19 | };
20 | DefaultProperty.propTypes ={
21 | title: PropTypes.string,
22 | value : PropTypes.number.isRequired,
23 | }
24 | export default DefaultProperty;
--------------------------------------------------------------------------------
/frontend/src/components/FocusDemo.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | class FocusDemo extends React.Component
4 | {
5 | constructor(props) {
6 | super(props);
7 | this.textInput = React.createRef();
8 | this.focusInput = this.focusInput.bind(this);
9 | }
10 | focusInput()
11 | {
12 | this.textInput.current.focus();
13 | }
14 | render() {
15 | return (
16 |
23 |
);
24 | }
25 | }
26 | export default FocusDemo;
--------------------------------------------------------------------------------
/frontend/src/components/Hello.js:
--------------------------------------------------------------------------------
1 |
2 | function Hello(props) {
3 | console.log('Hello',props);
4 | let user = props.user;
5 | let isAdmin = props.isAdmin;
6 | return (
7 |
8 | Hello Component
9 | {user.name}
10 | {isAdmin?"Admin":"User"}
11 |
12 |
Children
13 | {props.children}
14 |
15 | );
16 | }
17 | export default Hello;
--------------------------------------------------------------------------------
/frontend/src/components/class_component/ApiLoader.js:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import LabelComponent from "./LabelComponent";
3 |
4 | class ApiLoader extends React.Component
5 | {
6 | constructor(props) {
7 | super(props);
8 | this.state = {
9 | };
10 | }
11 | componentDidMount() {
12 | console.log('Component Did mount');
13 | fetch('https://jsonplaceholder.typicode.com/todos/1')
14 | .then(response => response.json())
15 | .then(json => this.setState({
16 | data : json
17 | }))
18 | }
19 | render() {
20 | console.log("API Loader render");
21 | return(
22 |
23 |
24 |
{this.state.data?this.state.data.title:'Loading'}
25 | {
26 | this.state.data &&
27 | }
28 |
29 | )
30 | }
31 | }
32 | export default ApiLoader;
--------------------------------------------------------------------------------
/frontend/src/components/class_component/EventComponent.js:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | class EventComponent extends React.Component
3 | {
4 | constructor(props) {
5 | super(props);
6 | this.divClick = this.divClick.bind(this);
7 | }
8 | onClickHandler(e)
9 | {
10 | console.log("Click ",e);
11 | }
12 | divClick()
13 | {
14 | console.log('Div Clicked ',this);
15 | }
16 | render() {
17 | return(
18 |
19 |
22 | {/*
23 | Hello
24 |
*/}
25 |
26 | Hello
27 |
28 |
29 | );
30 |
31 | }
32 | }
33 | export default EventComponent;
--------------------------------------------------------------------------------
/frontend/src/components/class_component/Greeting.js:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 |
3 | class User extends React.Component
4 | {
5 | render() {
6 | return (
7 |
8 | User
9 |
10 | );
11 | }
12 | }
13 | class Admin extends React.Component
14 | {
15 | render() {
16 | return (
17 |
18 | Admin
19 |
20 | );
21 | }
22 | }
23 | class Greeting extends React.Component
24 | {
25 | constructor(props) {
26 | super(props);
27 | }
28 | render() {
29 | let c = ;
30 | if(this.props.isAdmin)
31 | {
32 | c = ;
33 | }
34 |
35 | return (
36 |
37 | Greeting
38 | {c}
39 | {this.props.isAdmin?"Admin User":"Normal User"}
40 | {this.props.isAdmin?
:
}
41 |
42 | );
43 | }
44 | }
45 | export default Greeting;
--------------------------------------------------------------------------------
/frontend/src/components/class_component/LabelComponent.js:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | class LabelComponent extends React.Component
3 | {
4 | constructor(props) {
5 | super(props);
6 | }
7 | render() {
8 | return (
9 |
10 |
11 | Label {this.props.text}
12 |
13 | );
14 | }
15 | }
16 | export default LabelComponent;
--------------------------------------------------------------------------------
/frontend/src/components/class_component/ListItem.js:
--------------------------------------------------------------------------------
1 |
2 | import * as React from "react";
3 |
4 | class ListItem extends React.Component
5 | {
6 | constructor(props) {
7 | super(props);
8 | }
9 | clickItem(index)
10 | {
11 | console.log("Click item ",index);
12 | }
13 | render() {
14 | return (
15 |
16 | {
17 | this.props.data.map((item,index)=>{
18 | return (
19 | - this.clickItem(index)}>
22 | {item}
23 |
)
24 |
25 | })
26 | }
27 |
28 | );
29 | }
30 | }
31 | export default ListItem;
--------------------------------------------------------------------------------
/frontend/src/components/class_component/Loader.js:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 |
3 | class Loader extends React.Component
4 | {
5 | constructor(props) {
6 | super(props);
7 | }
8 | componentDidMount() {
9 | console.log('Component did mount');
10 | }
11 |
12 | render() {
13 |
14 | if(this.props.data)
15 | {
16 | return(
17 |
18 | Loader {this.props.data}
19 |
20 | );
21 |
22 | }
23 | else
24 | {
25 | return null;
26 | }
27 | }
28 | }
29 | export default Loader;
--------------------------------------------------------------------------------
/frontend/src/components/class_component/Welcome.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | class Welcome extends React.Component
3 | {
4 | render() {
5 | return (
6 |
7 |
{this.props.text}
8 |
9 | );
10 | }
11 | }
12 | export default Welcome;
--------------------------------------------------------------------------------
/frontend/src/components/context/MyContext.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | const MyContext = React.createContext({
4 | data: "Title",
5 | changeData :()=>{},
6 | });
7 | export default MyContext;
--------------------------------------------------------------------------------
/frontend/src/components/context/UpdateContext.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import MyContext from "./MyContext";
3 | import ParentComponent from "./ParentComponent";
4 | class UpdateContext extends React.Component{
5 | constructor(props) {
6 | super(props);
7 | this.changeData =()=> {
8 | this.setState({
9 | data : 'New update title'
10 | });
11 | };
12 | this.state = {
13 | data: 'New Default title'
14 | };
15 | }
16 | render() {
17 | return
22 | }
23 | }
24 | export default UpdateContext;
--------------------------------------------------------------------------------
/frontend/src/components/forward_ref/FancyButtonDemo.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | const FancyButton = React.forwardRef((props, ref) => {
4 | console.log('Ref ',ref);
5 | return (
6 |
9 | );
10 | });
11 |
12 | class FancyButtonDemo extends React.Component
13 | {
14 | render() {
15 | const ref = React.createRef();
16 | return (
17 |
18 | Click Me
19 |
20 |
21 |
);
22 | }
23 | }
24 | export default FancyButtonDemo;
--------------------------------------------------------------------------------
/frontend/src/components/fragment/FragmentDemo.js:
--------------------------------------------------------------------------------
1 |
2 | import React,{Fragment} from "react";
3 |
4 | const TableRow= (props)=>{
5 | return (
6 |
7 | <>
8 | {/* */}
9 |
10 | One
11 |
12 |
13 | Two
14 |
15 | {/* */}
16 | >
17 |
18 |
19 | )
20 | }
21 | class FragmentDemo extends React.Component
22 | {
23 | render() {
24 | return(
25 |
28 | );
29 | }
30 | }
31 | export default FragmentDemo;
--------------------------------------------------------------------------------
/frontend/src/components/function_as_child/RepeatDemo.js:
--------------------------------------------------------------------------------
1 | import React,{ Profiler } from "react";
2 |
3 | function Repeat(props) {
4 | let items = [];
5 | for (let i = 0; i < props.numTimes; i++) {
6 | items.push(props.children(i));
7 | }
8 | return {items}
;
9 | }
10 | function RepeatDemo() {
11 | return (
12 |
13 |
14 | {(index) => This is item {index} in the list
}
15 |
16 |
17 | );
18 | }
19 | const logTimes = (id, phase, actualTime, baseTime, startTime, commitTime) => {
20 | console.log(`${id}'s ${phase} phase:`);
21 | console.log(`Actual time: ${actualTime}`);
22 | console.log(`Base time: ${baseTime}`);
23 | console.log(`Start time: ${startTime}`);
24 | console.log(`Commit time: ${commitTime}`);
25 | };
26 | export default RepeatDemo;
27 |
--------------------------------------------------------------------------------
/frontend/src/components/hoc/logProps.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | function logProps(WrappedComponent)
4 | {
5 | //console.log('Here ',WrappedComponent);
6 | return class extends React.Component
7 | {
8 | componentDidUpdate(prevProps) {
9 | console.log('Current props: ', this.props);
10 | console.log('Previous props: ', prevProps);
11 | }
12 | render() {
13 | console.log('Log props called ',this.props);
14 | return(
15 | {
16 | this.props.loading ?
Loading
:
17 |
18 | }
19 |
)
20 |
21 | }
22 | }
23 | }
24 | export default logProps;
--------------------------------------------------------------------------------
/frontend/src/components/hooks/Child.js:
--------------------------------------------------------------------------------
1 | import React, { forwardRef, useImperativeHandle, useState } from 'react';
2 |
3 | function ChildComponent (props, ref) {
4 | console.log('Child re-render');
5 | const [openModal, setOpenModal] = useState(false);
6 |
7 |
8 | useImperativeHandle(ref, () => ({
9 | openChildModal: (value) => setOpenModal(value),
10 | }));
11 |
12 | if(!openModal) return null;
13 |
14 | return (
15 |
16 |
This is a modal!
17 |
20 |
21 | )
22 |
23 | }
24 |
25 | export default forwardRef(ChildComponent);
--------------------------------------------------------------------------------
/frontend/src/components/hooks/ContextHookDemo.js:
--------------------------------------------------------------------------------
1 | import {useContext} from "react";
2 | import MyContext from "./../context/MyContext";
3 | const ContextHookDemo=()=>{
4 | const myContext = useContext(MyContext);
5 | console.log('MyContext ',myContext);
6 | return (
7 |
8 | Context Hook Demo
9 |
{myContext.data}
10 |
11 | );
12 | }
13 | export default ContextHookDemo;
--------------------------------------------------------------------------------
/frontend/src/components/hooks/HookCounter.js:
--------------------------------------------------------------------------------
1 | import React,{useState} from "react";
2 |
3 | const HookCounter= (props)=>{
4 | const [count, setCount] = useState(0);
5 | const [text,setText] = useState('Counter is');
6 |
7 | let inc = ()=>{
8 | console.log('Inc');
9 | setCount(count+1);
10 | /*
11 | this.setState({
12 | count : this.state.count +1
13 | })
14 | * */
15 | };
16 | let changeText = ()=>{
17 | setText('Counter text update');
18 | };
19 | return (
20 | {text} {count}
21 |
24 |
27 |
)
28 | };
29 | export default HookCounter;
--------------------------------------------------------------------------------
/frontend/src/components/hooks/TextInputWithFocusButton.js:
--------------------------------------------------------------------------------
1 | import React,{useState,useReducer,useRef} from "react";
2 |
3 | const TextInputWithFocusButton=() =>{
4 | const inputEl = useRef(null);
5 | const onButtonClick = () => {
6 | // `current` points to the mounted text input element
7 | inputEl.current.focus();
8 | };
9 | return (
10 | <>
11 |
13 |
16 | >
17 | );
18 | }
19 | export default TextInputWithFocusButton;
--------------------------------------------------------------------------------
/frontend/src/components/hooks/UseIdDemo.js:
--------------------------------------------------------------------------------
1 | import React, { useImperativeHandle, useState } from 'react';
2 |
3 | const UseIdDemo = ()=>{
4 |
5 | //const id = useId();
6 | const id = "Some";
7 | return (
8 | Something
9 |
)
10 | }
11 | export default UseIdDemo;
--------------------------------------------------------------------------------
/frontend/src/components/hooks/UseImperativeParent.js:
--------------------------------------------------------------------------------
1 | import React,{useState,useDebugValue,useLayoutEffect,useRef} from "react";
2 | import Child from "./Child";
3 |
4 | const useFetch=(url)=>{
5 | useDebugValue('Custom Label '+url);
6 | };
7 | const UseImperativeParent = () => {
8 |
9 | const childRef = useRef(null);
10 | useFetch('https://jsonplaceholder.typicode.com/todos/1');
11 | const handleOpenModal = (value) => {
12 | childRef.current.openChildModal(value);
13 | }
14 | useLayoutEffect(()=>{
15 | console.log('Use layout effect');
16 | });
17 | console.log('Parent re-render');
18 |
19 | return (
20 |
21 |
This is a parent component
22 |
23 |
24 |
27 |
28 | )
29 |
30 | }
31 |
32 | export default UseImperativeParent;
--------------------------------------------------------------------------------
/frontend/src/components/hooks/reduce/CounterWithState.js:
--------------------------------------------------------------------------------
1 | import React, {useState} from "react";
2 | const CounterWithState= ()=>{
3 | let [count,setCount] = useState(1);
4 | return (
5 |
6 |
10 | {count}
11 |
15 |
16 | );
17 | };
18 | export default CounterWithState;
--------------------------------------------------------------------------------
/frontend/src/components/lazy/DynamicallyLoadedComponent.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | const DynamicallyLoadedComponent = (props)=>{
4 | return (
5 | Dynamically loaded component
6 |
)
7 | }
8 | export default DynamicallyLoadedComponent;
--------------------------------------------------------------------------------
/frontend/src/components/lazy/ErrorBoundary.js:
--------------------------------------------------------------------------------
1 | import React,{ Suspense } from "react";
2 | class ErrorBoundary extends React.Component{
3 | constructor(props) {
4 | super(props);
5 | this.state = { hasError: false };
6 | }
7 | static getDerivedStateFromError(error) {
8 | // Update state so the next render will show the fallback UI.
9 | return { hasError: true };
10 | }
11 |
12 | componentDidCatch(error, errorInfo) {
13 | // You can also log the error to an error reporting service
14 | console.log(error, errorInfo);
15 | }
16 | render() {
17 | if (this.state.hasError) {
18 | // You can render any custom fallback UI
19 | return Something went wrong.
;
20 | }
21 |
22 | return this.props.children;
23 | }
24 | }
25 | export default ErrorBoundary;
--------------------------------------------------------------------------------
/frontend/src/components/portal/Modal.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import * as ReactDOM from 'react-dom';
3 | const modalRoot = document.getElementById('modal-root');
4 | class Modal extends React.Component
5 | {
6 | constructor(props) {
7 | super(props);
8 | this.el = document.createElement('div');
9 | }
10 | componentDidMount() {
11 | modalRoot.appendChild(this.el);
12 | }
13 | componentWillUnmount() {
14 | modalRoot.removeChild(this.el);
15 | }
16 | render() {
17 | return ReactDOM.createPortal(
18 | this.props.children,
19 | this.el
20 | );
21 | }
22 |
23 | }
24 | export default Modal;
--------------------------------------------------------------------------------
/frontend/src/components/runtime_type/RuntimeTypeDemo.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | const ComponentOne = ()=>{
4 | return (
5 |
Component One
6 | )
7 | };
8 | const ComponentTwo = ()=>{
9 | return (
10 |
Component One
11 | )
12 | };
13 | const components ={
14 | "one":ComponentOne,
15 | "two":ComponentTwo,
16 | };
17 | const RuntimeTypeDemo = ()=>{
18 | let key = "one";
19 | let Component = components[key];
20 | return (
21 |
22 |
23 |
24 | );
25 | };
26 | export default RuntimeTypeDemo;
--------------------------------------------------------------------------------
/frontend/src/components/tab/Tab.css:
--------------------------------------------------------------------------------
1 | .tab-header
2 | {
3 | min-width: 50px;
4 | border:1px solid gray;
5 | padding:5px;
6 | }
7 | .tab-body
8 | {
9 | min-height: 200px;
10 | border:1px solid gray;
11 | padding:5px;
12 | margin:10px;
13 | }
--------------------------------------------------------------------------------
/frontend/src/components/thrid_party/DatePicker.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import $ from 'jquery';
3 | import datepickerFactory from 'jquery-datepicker';
4 | import datepickerJAFactory from 'jquery-datepicker/i18n/jquery.ui.datepicker-ja';
5 | datepickerFactory($);
6 | datepickerJAFactory($);
7 | class DatePicker extends React.Component
8 | {
9 | componentDidMount() {
10 | this.$el = $(this.el);
11 | this.$el.datepicker();
12 | }
13 |
14 | componentWillUnmount() {
15 | this.$el.datepicker('destroy');
16 | }
17 | render() {
18 | return (
19 | Date Picker
20 | this.el = el}>
22 |
);
23 | }
24 | }
25 | export default DatePicker;
--------------------------------------------------------------------------------
/frontend/src/components/uncontrolled/UnControlled.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | class UnControlled extends React.Component
4 | {
5 | constructor(props) {
6 | super(props);
7 | this.input = React.createRef();
8 | this.handleSubmit = this.handleSubmit.bind(this);
9 |
10 | }
11 | handleSubmit(event)
12 | {
13 | console.log('Name ',this.input.current.value);
14 | event.preventDefault();
15 | }
16 | render() {
17 | return (
18 |
25 |
);
26 | }
27 | }
28 | export default UnControlled;
--------------------------------------------------------------------------------
/frontend/src/components/unit_testing/User.js:
--------------------------------------------------------------------------------
1 | import {useParams} from "react-router-dom";
2 | export default function User()
3 | {
4 | let params = useParams();
5 | return (
6 |
User {params.userId}
7 | )
8 | }
--------------------------------------------------------------------------------
/frontend/src/features/counter/ReduxCounter.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { useSelector, useDispatch } from 'react-redux';
3 |
4 | import { decrement, increment } from './counterSlice';
5 | export default function ReduxCounter() {
6 | const counter = useSelector((state) => state.counter);
7 | const dispatch = useDispatch();
8 | console.log('Action increment',increment());
9 | return (
10 |
11 |
16 |
Redux Counter {counter.value}
17 |
22 | );
23 | }
--------------------------------------------------------------------------------
/frontend/src/features/counter/counterSlice.js:
--------------------------------------------------------------------------------
1 | import { createSlice } from '@reduxjs/toolkit'
2 |
3 | export const counterSlice = createSlice({
4 | name: 'counter',
5 | initialState: {
6 | value: 0,
7 | },
8 | reducers: {
9 | increment: (state) => {
10 | // Redux Toolkit allows us to write "mutating" logic in reducers. It
11 | // doesn't actually mutate the state because it uses the Immer library,
12 | // which detects changes to a "draft state" and produces a brand new
13 | // immutable state based off those changes
14 | state.value += 1
15 | },
16 | decrement: (state) => {
17 | state.value -= 1
18 | },
19 | incrementByAmount: (state, action) => {
20 | state.value += action.payload
21 | },
22 | },
23 | })
24 |
25 | // Action creators are generated for each case reducer function
26 | export const { increment, decrement, incrementByAmount } = counterSlice.actions
27 |
28 | export default counterSlice.reducer;
--------------------------------------------------------------------------------
/frontend/src/features/movie-list/MovieDetail.css:
--------------------------------------------------------------------------------
1 | .movie-details
2 | {
3 | border-radius: 10px;
4 | padding:20px;
5 | border:1px solid lightgray;
6 | min-height: 50px;
7 | margin-left:50px;
8 | margin-right:50px;
9 | margin-top:10px;
10 | margin-bottom:10px;
11 | }
12 | .movie-details-title
13 | {
14 | font-weight: bold;
15 | }
--------------------------------------------------------------------------------
/frontend/src/features/movie-list/MoviePreview.css:
--------------------------------------------------------------------------------
1 | .movie-preview
2 | {
3 | border-radius: 10px;
4 | padding:20px;
5 | border:1px solid lightgray;
6 | min-height: 50px;
7 | margin-left:50px;
8 | margin-right:50px;
9 | margin-bottom:10px;
10 | }
11 | .movie-preview-title
12 | {
13 | font-weight: bold;
14 | }
15 | .icon
16 | {
17 | cursor:pointer;
18 | }
--------------------------------------------------------------------------------
/frontend/src/features/movie-list/MovieReview.css:
--------------------------------------------------------------------------------
1 | .movie-review
2 | {
3 | border-radius: 10px;
4 | padding:20px;
5 | /*border-bottom: 1px solid lightgray;*/
6 | }
7 | .star
8 | {
9 | justify-content: center;
10 | display: flex;
11 | }
--------------------------------------------------------------------------------
/frontend/src/features/movie-list/movieApi.js:
--------------------------------------------------------------------------------
1 | import {API_URL} from "../../setting/API";
2 | /*import {Movie} from "./movieSlice";*/
3 | import axios from "../../setting/our_axios";
4 |
5 |
6 | const API = API_URL+"movies"
7 |
8 | export function getAllMovie(){
9 | console.log('Called getAllMovie with axios');
10 | return axios.get(API);
11 | }
--------------------------------------------------------------------------------
/frontend/src/features/review/reviewApi.js:
--------------------------------------------------------------------------------
1 | import {API_URL} from "../../setting/API";
2 | /*import {Movie} from "./movieSlice";*/
3 | import axios from "../../setting/our_axios";
4 |
5 |
6 | const API = API_URL+"reviews"
7 |
8 | export function getAllReviewByMovieId(movieId){
9 | console.log('Called getAllReviewByMovieId with axios');
10 | return axios.get(API+`/movie/${movieId}`);
11 | }
12 |
13 | export function saveReview(review){
14 | console.log('Called saveReview with axios');
15 | return axios.post(API,review);
16 | }
17 |
18 | export function deleteReview(reviewId){
19 | console.log('Called saveReview with axios');
20 | return axios.delete(API+`/${reviewId}`);
21 | }
22 | export function updateReview(reviewId,review){
23 | console.log('Called updateReview with axios ',review);
24 | return axios.patch(API+`/${reviewId}`,review);
25 | }
26 |
--------------------------------------------------------------------------------
/frontend/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/frontend/src/pages/MovieListDetailPage.js:
--------------------------------------------------------------------------------
1 | import React, {useEffect} from "react";
2 | import {useParams} from "react-router-dom";
3 | import {shallowEqual, useDispatch, useSelector} from "react-redux";
4 | import {selectMovieById} from "../features/movie-list/movieSlice";
5 | import MovieDetails from "../features/movie-list/MovieDetails";
6 | import {apiGetReviewByMovieId, selectReviewByMovieById} from "../features/review/reviewSlice";
7 |
8 | const MovieListDetailPage = ()=>{
9 | console.log('Movie list Detail');
10 |
11 | let dispatch = useDispatch();
12 | let params = useParams();
13 | const movie = useSelector(state=>selectMovieById(state,params.movieId));
14 | const reviews = useSelector(state=>selectReviewByMovieById(state,movie._id));
15 | console.log('Movie Data from redux ',movie);
16 | useEffect(()=>{
17 | dispatch(apiGetReviewByMovieId(movie._id));
18 | },[]);
19 | return(
20 |
22 |
)
23 | };
24 | export default MovieListDetailPage;
--------------------------------------------------------------------------------
/frontend/src/pages/MovieListPage.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import MovieList from "../features/movie-list/MovieList";
3 | const MovieListPage = ()=>{
4 | return(
5 |
Movie List Page
6 |
7 | )
8 | };
9 | export default MovieListPage;
--------------------------------------------------------------------------------
/frontend/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/frontend/src/routes/Expense.js:
--------------------------------------------------------------------------------
1 | import {Link} from "react-router-dom";
2 | import React from "react";
3 |
4 | export default function Expense() {
5 | return (
6 |
7 | Expense
8 | Back to Home |{" "}
9 |
10 | );
11 | }
--------------------------------------------------------------------------------
/frontend/src/routes/Invoice.js:
--------------------------------------------------------------------------------
1 | import {Link,useSearchParams} from "react-router-dom";
2 | import React from "react";
3 |
4 | export default function Invoice() {
5 | let [searchParams, setSearchParams] = useSearchParams();
6 | return (
7 |
8 | Invoices
9 | Search {searchParams.get("data")}
10 | Back to Home |{" "}
11 |
12 | );
13 | }
--------------------------------------------------------------------------------
/frontend/src/routes/NotFound.js:
--------------------------------------------------------------------------------
1 | export default function NotFound (){
2 | return (
3 |
Page Not Found
4 | );
5 | }
--------------------------------------------------------------------------------
/frontend/src/setting/API.js:
--------------------------------------------------------------------------------
1 | export const API_URL = "http://localhost:3000/api/";
--------------------------------------------------------------------------------
/frontend/src/setting/our_axios.js:
--------------------------------------------------------------------------------
1 | import {API_URL} from "./API";
2 | const axios = require('axios');
3 |
4 | //import useAuth from "../services/authService";
5 |
6 | axios.defaults.headers.post['Content-Type'] = 'application/json';
7 | let store;
8 |
9 | export const injectStore = (_store) => {
10 | store = _store;
11 | }
12 | /*
13 | axios.interceptors.request.use(async function (config:any) {
14 | console.log('API request ',store.getState());
15 | const authUser = store.getState().auth;
16 | console.log('API request auth user ',authUser);
17 | if( authUser.token)
18 | {
19 | config.headers.Authorization = 'Bearer '+ authUser.token;
20 | }
21 |
22 | return config;
23 | },function(error:any){
24 | console.log("Axios interceptor error ",error);
25 | return error;
26 | });
27 |
28 | */
29 | export default axios;
30 |
--------------------------------------------------------------------------------
/frontend/src/setupTests.js:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom';
6 |
--------------------------------------------------------------------------------
/frontend/src/utils/Util.js:
--------------------------------------------------------------------------------
1 | export function formatUserName(username) {
2 | return '@' + username;
3 | }
--------------------------------------------------------------------------------
/frontend/src/utils/Util.test.js:
--------------------------------------------------------------------------------
1 | import { formatUserName } from "./Util";
2 |
3 | describe('Utils', () => {
4 | test('formatUserName adds @ at the beginning of the username', () => {
5 | expect(formatUserName('jc')).toBe('@jc');
6 | });
7 | });
--------------------------------------------------------------------------------
/react-redux-typescript/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/react-redux-typescript/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/react-redux-typescript/.idea/react-redux-typescript.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/react-redux-typescript/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/react-redux-typescript/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringReact3rdBatch/2b04370d84c790bd64ceeba979194fdc467d3ece/react-redux-typescript/public/favicon.ico
--------------------------------------------------------------------------------
/react-redux-typescript/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringReact3rdBatch/2b04370d84c790bd64ceeba979194fdc467d3ece/react-redux-typescript/public/logo192.png
--------------------------------------------------------------------------------
/react-redux-typescript/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrthetkhine/TuringReact3rdBatch/2b04370d84c790bd64ceeba979194fdc467d3ece/react-redux-typescript/public/logo512.png
--------------------------------------------------------------------------------
/react-redux-typescript/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/react-redux-typescript/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/react-redux-typescript/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | pointer-events: none;
8 | }
9 |
10 | @media (prefers-reduced-motion: no-preference) {
11 | .App-logo {
12 | animation: App-logo-float infinite 3s ease-in-out;
13 | }
14 | }
15 |
16 | .App-header {
17 | min-height: 100vh;
18 | display: flex;
19 | flex-direction: column;
20 | align-items: center;
21 | justify-content: center;
22 | font-size: calc(10px + 2vmin);
23 | }
24 |
25 | .App-link {
26 | color: rgb(112, 76, 182);
27 | }
28 |
29 | @keyframes App-logo-float {
30 | 0% {
31 | transform: translateY(0);
32 | }
33 | 50% {
34 | transform: translateY(10px);
35 | }
36 | 100% {
37 | transform: translateY(0px);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/react-redux-typescript/src/App.test.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from '@testing-library/react';
3 | import { Provider } from 'react-redux';
4 | import { store } from './app/store';
5 | import App from './App';
6 |
7 | test('renders learn react link', () => {
8 | const { getByText } = render(
9 |
10 |
11 |
12 | );
13 |
14 | expect(getByText(/learn/i)).toBeInTheDocument();
15 | });
16 |
--------------------------------------------------------------------------------
/react-redux-typescript/src/app/hooks.ts:
--------------------------------------------------------------------------------
1 | import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux';
2 | import type { RootState, AppDispatch } from './store';
3 |
4 | // Use throughout your app instead of plain `useDispatch` and `useSelector`
5 | export const useAppDispatch = () => useDispatch();
6 | export const useAppSelector: TypedUseSelectorHook = useSelector;
7 |
--------------------------------------------------------------------------------
/react-redux-typescript/src/app/store.ts:
--------------------------------------------------------------------------------
1 | import { configureStore, ThunkAction, Action } from '@reduxjs/toolkit';
2 | import counterReducer from '../features/counter/counterSlice';
3 | import todoReducer from '../features/todos/todoSlice';
4 | import movieReducer from '../features/movie/movieSlice';
5 | import reviewReducer from '../features/review/reviewSlice';
6 | import authReducer from '../features/auth/authSlice';
7 | export const store = configureStore({
8 | reducer: {
9 | counter: counterReducer,
10 | todo: todoReducer,
11 | movie: movieReducer,
12 | review : reviewReducer,
13 | auth : authReducer,
14 | },
15 | });
16 |
17 | export type AppDispatch = typeof store.dispatch;
18 | export type RootState = ReturnType;
19 | export type AppThunk = ThunkAction<
20 | ReturnType,
21 | RootState,
22 | unknown,
23 | Action
24 | >;
25 |
--------------------------------------------------------------------------------
/react-redux-typescript/src/component/PrivateRoute.tsx:
--------------------------------------------------------------------------------
1 | import React,{Component} from 'react';
2 | import {
3 | Link,
4 | Route,
5 | Navigate,
6 | } from "react-router-dom";
7 | /*
8 | interface PrivateRouteParams{
9 | element:Component,
10 | redirectTo:string,
11 | isAuth:boolean,
12 | path:string,
13 | props?:any
14 | }*/
15 | export default function PrivateRoute({ children,
16 | redirectTo,
17 | isAuth,
18 | path, ...props }:any) {
19 |
20 | console.log('Is auth ',isAuth, ' redirectTo ',redirectTo);
21 | return isAuth ? children : ;
22 | }
23 |
--------------------------------------------------------------------------------
/react-redux-typescript/src/features/auth/authApi.ts:
--------------------------------------------------------------------------------
1 | import {API_URL} from "../../setting/API";
2 | import axios from "../../setting/our_axios";
3 |
4 |
5 |
6 |
7 | export function login(username:string,password:string){
8 | const loginUrl = API_URL+"/users/login";
9 | return axios.post(loginUrl,{
10 | userName: username,
11 | password
12 | });
13 | }
--------------------------------------------------------------------------------
/react-redux-typescript/src/features/counter/counterAPI.ts:
--------------------------------------------------------------------------------
1 | // A mock function to mimic making an async request for data
2 | export function fetchCount(amount = 1) {
3 | return new Promise<{ data: number }>((resolve) =>
4 | setTimeout(() => resolve({ data: amount }), 500)
5 | );
6 | }
7 |
--------------------------------------------------------------------------------
/react-redux-typescript/src/features/counter/counterSlice.spec.ts:
--------------------------------------------------------------------------------
1 | import counterReducer, {
2 | CounterState,
3 | increment,
4 | decrement,
5 | incrementByAmount,
6 | } from './counterSlice';
7 |
8 | describe('counter reducer', () => {
9 | const initialState: CounterState = {
10 | value: 3,
11 | status: 'idle',
12 | };
13 | it('should handle initial state', () => {
14 | expect(counterReducer(undefined, { type: 'unknown' })).toEqual({
15 | value: 0,
16 | status: 'idle',
17 | });
18 | });
19 |
20 | it('should handle increment', () => {
21 | const actual = counterReducer(initialState, increment());
22 | expect(actual.value).toEqual(4);
23 | });
24 |
25 | it('should handle decrement', () => {
26 | const actual = counterReducer(initialState, decrement());
27 | expect(actual.value).toEqual(2);
28 | });
29 |
30 | it('should handle incrementByAmount', () => {
31 | const actual = counterReducer(initialState, incrementByAmount(2));
32 | expect(actual.value).toEqual(5);
33 | });
34 | });
35 |
--------------------------------------------------------------------------------
/react-redux-typescript/src/features/movie/Movie.css:
--------------------------------------------------------------------------------
1 | .movie
2 | {
3 | border:1px solid lightgray;
4 | margin-top: 10px;
5 | margin-bottom: 10px;
6 | margin-left: 50px;
7 | margin-right: 50px;
8 | border-radius: 10px;
9 | min-height: 100px;
10 | }
11 | .movie-title
12 | {
13 | font-weight: bold;
14 | border-bottom: 1px solid lightgray;
15 | }
--------------------------------------------------------------------------------
/react-redux-typescript/src/features/movie/MovieList.tsx:
--------------------------------------------------------------------------------
1 | import MovieUI from "./MovieUI";
2 | import {Movie} from "./movieSlice";
3 |
4 | export default function MovieList(props:any) {
5 | const {movies} = props;
6 | console.log('Movie List ',movies);
7 | return (
8 | Movie List
9 | {
10 | movies.map((movie:Movie)=>
13 | )
14 | }
15 |
);
16 | }
--------------------------------------------------------------------------------
/react-redux-typescript/src/features/movie/movieApi.ts:
--------------------------------------------------------------------------------
1 | import {API_URL} from "../../setting/API";
2 | import {Movie} from "./movieSlice";
3 | import axios from "../../setting/our_axios";
4 |
5 |
6 | const API = API_URL+"/movies"
7 |
8 | export function getAllMovie() {
9 | return axios.get(API);
10 | }
11 | export function saveMovie(movie:Movie){
12 | console.log('Save movie backend ',movie);
13 | return axios.post(API,movie);
14 | }
15 | export function updateMovie(movie:Movie){
16 | console.log('update movie backend ',movie);
17 | return axios.patch(API+`/${movie._id}`,movie);
18 | }
19 | export function deleteMovie(movie:Movie){
20 | console.log('Delete movie backend ',movie);
21 | return axios.delete(API+`/${movie._id}`,movie);
22 | }
--------------------------------------------------------------------------------
/react-redux-typescript/src/features/review/Review.css:
--------------------------------------------------------------------------------
1 | .review
2 | {
3 | border-bottom: 1px solid lightgray;
4 | margin-bottom: 10px;
5 | }
--------------------------------------------------------------------------------
/react-redux-typescript/src/features/review/ReviewListUI.tsx:
--------------------------------------------------------------------------------
1 | import {apiGetAllReviewByMovieIfNotLoaded, Review, selectReview, selectReviewMovieById} from "./reviewSlice";
2 | import ReviewUI from "./ReviewUI";
3 | import {useAppDispatch, useAppSelector} from "../../app/hooks";
4 | import {useEffect} from "react";
5 | import {shallowEqual} from 'react-redux';
6 | export default function ReviewListUI(props:any) {
7 | console.log('Review list render');
8 | let {movie} = props;
9 | const dispatch = useAppDispatch();
10 | useEffect(()=>{
11 | dispatch(apiGetAllReviewByMovieIfNotLoaded(movie._id!));
12 | },[]);
13 | const allReview = useAppSelector(selectReview );
14 | const reviews = selectReviewMovieById(allReview,movie._id!);
15 | return(
16 |
17 | {
18 | reviews.map((review:Review)=> )
21 | }
22 |
23 | );
24 |
25 | }
--------------------------------------------------------------------------------
/react-redux-typescript/src/features/review/ReviewUI.tsx:
--------------------------------------------------------------------------------
1 | import {Review} from "./reviewSlice";
2 | import './Review.css';
3 | export default function ReviewUI(props:any) {
4 | let {review} = props;
5 | return (
6 |
Rating {review.rating}
7 |
Review {review.review}
8 |
);
9 | }
--------------------------------------------------------------------------------
/react-redux-typescript/src/features/review/reviewApi.ts:
--------------------------------------------------------------------------------
1 | import {API_URL} from "../../setting/API";
2 | import {Movie} from "./../movie/movieSlice";
3 | import {Review} from './reviewSlice';
4 | import axios from "../../setting/our_axios";
5 |
6 |
7 | const API = API_URL+"/reviews"
8 |
9 | export function getAllReviewByMovieId(movieId:string) {
10 | return axios.get(API+`/movie/${movieId}`);
11 | }
--------------------------------------------------------------------------------
/react-redux-typescript/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 | .login-page
15 | {
16 | margin-left:200px;
17 | margin-right: 200px;
18 | }
--------------------------------------------------------------------------------
/react-redux-typescript/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { createRoot } from 'react-dom/client';
3 | import { Provider } from 'react-redux';
4 | import { store } from './app/store';
5 | import App from './App';
6 | import reportWebVitals from './reportWebVitals';
7 | import 'bootstrap/dist/css/bootstrap.min.css';
8 | import './index.css';
9 | import {injectStore} from "./setting/our_axios";
10 | injectStore(store);
11 | const container = document.getElementById('root')!;
12 | const root = createRoot(container);
13 |
14 | root.render(
15 |
16 |
17 |
18 |
19 |
20 | );
21 |
22 | // If you want to start measuring performance in your app, pass a function
23 | // to log results (for example: reportWebVitals(console.log))
24 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
25 | reportWebVitals();
26 |
--------------------------------------------------------------------------------
/react-redux-typescript/src/pages/HomePage.tsx:
--------------------------------------------------------------------------------
1 | export default function HomePage() {
2 | return
3 | Home Page
4 |
5 | }
--------------------------------------------------------------------------------
/react-redux-typescript/src/pages/LogoutPage.tsx:
--------------------------------------------------------------------------------
1 | import {useAppDispatch} from "../app/hooks";
2 | import {useNavigate,useParams,useLocation} from "react-router-dom";
3 | import {logout} from './../features/auth/authSlice';
4 | export default function LogoutPage()
5 | {
6 | let navigate = useNavigate();
7 | let dispatch = useAppDispatch();
8 | let logoutHandler = ()=>{
9 | console.log("Logout ");
10 | dispatch(logout());
11 | navigate("/");
12 |
13 | }
14 | return (
15 |
18 |
);
19 | }
--------------------------------------------------------------------------------
/react-redux-typescript/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/react-redux-typescript/src/reportWebVitals.ts:
--------------------------------------------------------------------------------
1 | import { ReportHandler } from 'web-vitals';
2 |
3 | const reportWebVitals = (onPerfEntry?: ReportHandler) => {
4 | if (onPerfEntry && onPerfEntry instanceof Function) {
5 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
6 | getCLS(onPerfEntry);
7 | getFID(onPerfEntry);
8 | getFCP(onPerfEntry);
9 | getLCP(onPerfEntry);
10 | getTTFB(onPerfEntry);
11 | });
12 | }
13 | };
14 |
15 | export default reportWebVitals;
16 |
--------------------------------------------------------------------------------
/react-redux-typescript/src/services/authService.ts:
--------------------------------------------------------------------------------
1 | import { useAppSelector, useAppDispatch } from '../app/hooks';
2 | import {selectAuth} from "../features/auth/authSlice";
3 |
4 | export default function useAuth()
5 | {
6 | let authUser = useAppSelector(selectAuth);
7 | console.log("Use Auth user",authUser);
8 | return authUser;
9 | }
10 | export function useAuthentication()
11 | {
12 | let authUser = useAuth();
13 | return authUser.token;
14 | }
--------------------------------------------------------------------------------
/react-redux-typescript/src/setting/API.ts:
--------------------------------------------------------------------------------
1 | export const API_URL = "http://localhost:3000/api";
--------------------------------------------------------------------------------
/react-redux-typescript/src/setting/our_axios.ts:
--------------------------------------------------------------------------------
1 | import {API_URL} from "../setting/API";
2 | //import useAuth from "../services/authService";
3 | const axios = require('axios');
4 | axios.defaults.headers.post['Content-Type'] = 'application/json';
5 | let store:any;
6 |
7 | export const injectStore = (_store:any) => {
8 | store = _store;
9 | }
10 |
11 | axios.interceptors.request.use(async function (config:any) {
12 | console.log('API request ',store.getState());
13 | const authUser = store.getState().auth;
14 | console.log('API request auth user ',authUser);
15 | if( authUser.token)
16 | {
17 | config.headers.Authorization = 'Bearer '+ authUser.token;
18 | }
19 |
20 | return config;
21 | },function(error:any){
22 | console.log("Axios interceptor error ",error);
23 | return error;
24 | });
25 |
26 |
27 | export default axios;
--------------------------------------------------------------------------------
/react-redux-typescript/src/setupTests.ts:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom/extend-expect';
6 |
--------------------------------------------------------------------------------
/react-redux-typescript/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ],
9 | "allowJs": true,
10 | "skipLibCheck": true,
11 | "esModuleInterop": true,
12 | "allowSyntheticDefaultImports": true,
13 | "strict": true,
14 | "forceConsistentCasingInFileNames": true,
15 | "noFallthroughCasesInSwitch": true,
16 | "module": "esnext",
17 | "moduleResolution": "node",
18 | "resolveJsonModule": true,
19 | "isolatedModules": true,
20 | "noEmit": true,
21 | "jsx": "react-jsx"
22 | },
23 | "include": [
24 | "src"
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/typescript/AnyType.js:
--------------------------------------------------------------------------------
1 | var data = "String";
2 | console.log("Data ", data);
3 | data = 12;
4 | console.log('Data ', data);
5 | function sum(a, b) {
6 | return a + b;
7 | }
8 | console.log("Sum ", sum(1, 2));
9 | //console.log("Sum ",sum(1,"2"));
10 |
--------------------------------------------------------------------------------
/typescript/AnyType.ts:
--------------------------------------------------------------------------------
1 | let data:any = "String";
2 | console.log("Data ",data);
3 |
4 | data = 12;
5 | console.log('Data ',data);
6 |
7 | function sum(a: number, b : number):number
8 | {
9 | return a + b;
10 | }
11 | console.log("Sum ",sum(1,2));
12 | //console.log("Sum ",sum(1,"2"));
--------------------------------------------------------------------------------
/typescript/Hello.js:
--------------------------------------------------------------------------------
1 | var data = "Hello"; //Type Inferencing
2 | //data = false;
3 | var result = data + 2;
4 | console.log('Result ', result);
5 | var obj = {
6 | name: "Tk",
7 | age: 37
8 | };
9 | obj.name = 'Update';
10 | var another = obj;
11 | console.log('Obj ', obj);
12 | console.log('Another ', another);
13 | console.log('Type of another ', typeof another);
14 |
--------------------------------------------------------------------------------
/typescript/Hello.ts:
--------------------------------------------------------------------------------
1 | var data:string = "Hello"; //Type Inferencing
2 | //data = false;
3 | var result = data +2;
4 | console.log('Result ',result);
5 |
6 | interface User
7 | {
8 | name: string,
9 | age : number;
10 | }
11 | let obj: User = {
12 | name : "Tk",
13 | age :37
14 | };
15 | obj.name = 'Update';
16 | interface Another
17 | {
18 | name: string,
19 | age : number;
20 | }
21 | let another:Another = obj;
22 | console.log('Obj ',obj);
23 | console.log('Another ',another);
24 | console.log('Type of another ',typeof another);
25 |
--------------------------------------------------------------------------------
/typescript/Problem.html:
--------------------------------------------------------------------------------
1 |
2 |
14 |
--------------------------------------------------------------------------------
/typescript/callback.js:
--------------------------------------------------------------------------------
1 | function hello() {
2 | console.log('Hello');
3 | }
4 | var fun = hello;
5 | fun();
6 | function sum(a, b) {
7 | return a + b;
8 | }
9 | var fun2 = sum;
10 | console.log('Func2 ', fun2(1));
11 |
--------------------------------------------------------------------------------
/typescript/callback.ts:
--------------------------------------------------------------------------------
1 | type NoParameterCallBack = ()=>void;
2 | type Another =(a:number,b:number)=>number;
3 | function hello()
4 | {
5 | console.log('Hello');
6 | }
7 | let fun:NoParameterCallBack = hello;
8 | fun();
9 |
10 | function sum(a:number,b:number):number
11 | {
12 | return a+b;
13 | }
14 | let fun2:Another = sum;
15 | console.log('Func2 ',fun2(1,2));
16 |
--------------------------------------------------------------------------------
/typescript/gencallback.js:
--------------------------------------------------------------------------------
1 | var obj = {
2 | add: function (data) {
3 | this.data = data;
4 | console.log('Add ', data);
5 | },
6 | get: function () {
7 | return this.data;
8 | }
9 | };
10 | var obj2 = obj;
11 | obj.add("Some");
12 | console.log('Get ', obj.get());
13 |
--------------------------------------------------------------------------------
/typescript/gencallback.ts:
--------------------------------------------------------------------------------
1 | interface Backpack {
2 | add: (obj: Type) => void;
3 | get: () => Type;
4 | }
5 |
6 | let obj = {
7 |
8 | add(data : string)
9 | {
10 | this.data = data;
11 | console.log('Add ',data);
12 | },
13 | get():string
14 | {
15 | return this.data;
16 | }
17 | }
18 | let obj2 : Backpack = obj;
19 | obj.add("Some");
20 | console.log('Get ',obj.get());
--------------------------------------------------------------------------------
/typescript/generic.ts:
--------------------------------------------------------------------------------
1 | type StringArray = Array;
2 | let data : StringArray = ["Hello","One"];
3 | //data[0] = 12;
4 |
5 | type Money = number;
6 | let amount: Money;
7 | let total:number = 10;
8 |
9 | amount = total;
--------------------------------------------------------------------------------
/typescript/union.js:
--------------------------------------------------------------------------------
1 | var background = "red";
2 | var data = "Hello";
3 | data = ["Hello", "Another"];
4 | console.log('Data ', data);
5 |
--------------------------------------------------------------------------------
/typescript/union.ts:
--------------------------------------------------------------------------------
1 | type Color = "red" | "green" | "blue";
2 | let background:Color = "red";
3 | //background = "Something";
4 |
5 | type StrOrStrArray = string | string[];
6 | let data: StrOrStrArray = "Hello";
7 | data = ["Hello","Another"];
8 |
9 | console.log('Data ',data);
--------------------------------------------------------------------------------