Skip to content

Commit c3029ce

Browse files
committed
routing enabled
1 parent 7232a06 commit c3029ce

File tree

5 files changed

+152
-12
lines changed

5 files changed

+152
-12
lines changed

client/src/App.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
1-
import "./App.css";
2-
import Homepage from "./Containers/Homepage";
1+
import React, { Suspense } from "react";
2+
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
3+
import Loading from "./Components/Loading";
4+
import { routes } from "./Routes/Routes";
35
function App() {
4-
return <Homepage />;
6+
const routcomponent = routes.map(({ path, component, id }) => (
7+
<Route exact path={path} component={component} key={id} />
8+
));
9+
return (
10+
<>
11+
<Suspense fallback={<Loading />}>
12+
<Router>
13+
<Switch>{routcomponent}</Switch>
14+
</Router>
15+
</Suspense>
16+
</>
17+
);
518
}
619

720
export default App;

client/src/App.test.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

client/src/Routes/Routes.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import React from "react";
2+
const Homepage = React.lazy(() => import("../Containers/Homepage"));
3+
export const routes = [{ id: 0, path: "/", component: Homepage }];

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"dependencies": {
1818
"concurrently": "^5.3.0",
1919
"express": "^4.17.1",
20-
"nodemon": "^2.0.7"
20+
"nodemon": "^2.0.7",
21+
"react-router-dom": "^5.2.0"
2122
}
2223
}

yarn.lock

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
# yarn lockfile v1
33

44

5+
"@babel/runtime@^7.1.2", "@babel/runtime@^7.12.1":
6+
version "7.12.5"
7+
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.5.tgz#410e7e487441e1b360c29be715d870d9b985882e"
8+
integrity sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==
9+
dependencies:
10+
regenerator-runtime "^0.13.4"
11+
512
"@sindresorhus/is@^0.14.0":
613
version "0.14.0"
714
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea"
@@ -567,6 +574,25 @@ has@^1.0.3:
567574
dependencies:
568575
function-bind "^1.1.1"
569576

577+
history@^4.9.0:
578+
version "4.10.1"
579+
resolved "https://registry.yarnpkg.com/history/-/history-4.10.1.tgz#33371a65e3a83b267434e2b3f3b1b4c58aad4cf3"
580+
integrity sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==
581+
dependencies:
582+
"@babel/runtime" "^7.1.2"
583+
loose-envify "^1.2.0"
584+
resolve-pathname "^3.0.0"
585+
tiny-invariant "^1.0.2"
586+
tiny-warning "^1.0.0"
587+
value-equal "^1.0.1"
588+
589+
hoist-non-react-statics@^3.1.0:
590+
version "3.3.2"
591+
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"
592+
integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==
593+
dependencies:
594+
react-is "^16.7.0"
595+
570596
hosted-git-info@^2.1.4:
571597
version "2.8.8"
572598
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.8.tgz#7539bd4bc1e0e0a895815a2e0262420b12858488"
@@ -732,6 +758,16 @@ is-yarn-global@^0.3.0:
732758
resolved "https://registry.yarnpkg.com/is-yarn-global/-/is-yarn-global-0.3.0.tgz#d502d3382590ea3004893746754c89139973e232"
733759
integrity sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==
734760

761+
762+
version "0.0.1"
763+
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
764+
integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=
765+
766+
"js-tokens@^3.0.0 || ^4.0.0":
767+
version "4.0.0"
768+
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
769+
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
770+
735771
736772
version "3.0.0"
737773
resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.0.tgz#5b1f397afc75d677bde8bcfc0e47e1f9a3d9a898"
@@ -769,6 +805,13 @@ lodash@^4.17.15:
769805
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
770806
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
771807

808+
loose-envify@^1.2.0, loose-envify@^1.3.1, loose-envify@^1.4.0:
809+
version "1.4.0"
810+
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
811+
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
812+
dependencies:
813+
js-tokens "^3.0.0 || ^4.0.0"
814+
772815
lowercase-keys@^1.0.0, lowercase-keys@^1.0.1:
773816
version "1.0.1"
774817
resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f"
@@ -823,6 +866,14 @@ mimic-response@^1.0.0, mimic-response@^1.0.1:
823866
resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b"
824867
integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==
825868

869+
mini-create-react-context@^0.4.0:
870+
version "0.4.1"
871+
resolved "https://registry.yarnpkg.com/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz#072171561bfdc922da08a60c2197a497cc2d1d5e"
872+
integrity sha512-YWCYEmd5CQeHGSAKrYvXgmzzkrvssZcuuQDDeqkT+PziKGMgE+0MCCtcKbROzocGBG1meBLl2FotlRwf4gAzbQ==
873+
dependencies:
874+
"@babel/runtime" "^7.12.1"
875+
tiny-warning "^1.0.3"
876+
826877
minimatch@^3.0.4:
827878
version "3.0.4"
828879
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
@@ -898,6 +949,11 @@ normalize-url@^4.1.0:
898949
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.5.0.tgz#453354087e6ca96957bd8f5baf753f5982142129"
899950
integrity sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==
900951

952+
object-assign@^4.1.1:
953+
version "4.1.1"
954+
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
955+
integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=
956+
901957
on-finished@~2.3.0:
902958
version "2.3.0"
903959
resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947"
@@ -974,6 +1030,13 @@ [email protected]:
9741030
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c"
9751031
integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=
9761032

1033+
path-to-regexp@^1.7.0:
1034+
version "1.8.0"
1035+
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.8.0.tgz#887b3ba9d84393e87a0a0b9f4cb756198b53548a"
1036+
integrity sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==
1037+
dependencies:
1038+
isarray "0.0.1"
1039+
9771040
picomatch@^2.0.4, picomatch@^2.2.1:
9781041
version "2.2.2"
9791042
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad"
@@ -989,6 +1052,15 @@ prepend-http@^2.0.0:
9891052
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897"
9901053
integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=
9911054

1055+
prop-types@^15.6.2:
1056+
version "15.7.2"
1057+
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
1058+
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
1059+
dependencies:
1060+
loose-envify "^1.4.0"
1061+
object-assign "^4.1.1"
1062+
react-is "^16.8.1"
1063+
9921064
proxy-addr@~2.0.5:
9931065
version "2.0.6"
9941066
resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.6.tgz#fdc2336505447d3f2f2c638ed272caf614bbb2bf"
@@ -1047,6 +1119,40 @@ rc@^1.2.8:
10471119
minimist "^1.2.0"
10481120
strip-json-comments "~2.0.1"
10491121

1122+
react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1:
1123+
version "16.13.1"
1124+
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
1125+
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
1126+
1127+
react-router-dom@^5.2.0:
1128+
version "5.2.0"
1129+
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.2.0.tgz#9e65a4d0c45e13289e66c7b17c7e175d0ea15662"
1130+
integrity sha512-gxAmfylo2QUjcwxI63RhQ5G85Qqt4voZpUXSEqCwykV0baaOTQDR1f0PmY8AELqIyVc0NEZUj0Gov5lNGcXgsA==
1131+
dependencies:
1132+
"@babel/runtime" "^7.1.2"
1133+
history "^4.9.0"
1134+
loose-envify "^1.3.1"
1135+
prop-types "^15.6.2"
1136+
react-router "5.2.0"
1137+
tiny-invariant "^1.0.2"
1138+
tiny-warning "^1.0.0"
1139+
1140+
1141+
version "5.2.0"
1142+
resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.2.0.tgz#424e75641ca8747fbf76e5ecca69781aa37ea293"
1143+
integrity sha512-smz1DUuFHRKdcJC0jobGo8cVbhO3x50tCL4icacOlcwDOEQPq4TMqwx3sY1TP+DvtTgz4nm3thuo7A+BK2U0Dw==
1144+
dependencies:
1145+
"@babel/runtime" "^7.1.2"
1146+
history "^4.9.0"
1147+
hoist-non-react-statics "^3.1.0"
1148+
loose-envify "^1.3.1"
1149+
mini-create-react-context "^0.4.0"
1150+
path-to-regexp "^1.7.0"
1151+
prop-types "^15.6.2"
1152+
react-is "^16.6.0"
1153+
tiny-invariant "^1.0.2"
1154+
tiny-warning "^1.0.0"
1155+
10501156
read-pkg@^4.0.1:
10511157
version "4.0.1"
10521158
resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-4.0.1.tgz#963625378f3e1c4d48c85872b5a6ec7d5d093237"
@@ -1063,6 +1169,11 @@ readdirp@~3.5.0:
10631169
dependencies:
10641170
picomatch "^2.2.1"
10651171

1172+
regenerator-runtime@^0.13.4:
1173+
version "0.13.7"
1174+
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz#cac2dacc8a1ea675feaabaeb8ae833898ae46f55"
1175+
integrity sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==
1176+
10661177
registry-auth-token@^4.0.0:
10671178
version "4.2.1"
10681179
resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-4.2.1.tgz#6d7b4006441918972ccd5fedcd41dc322c79b250"
@@ -1087,6 +1198,11 @@ require-main-filename@^2.0.0:
10871198
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b"
10881199
integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==
10891200

1201+
resolve-pathname@^3.0.0:
1202+
version "3.0.0"
1203+
resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-3.0.0.tgz#99d02224d3cf263689becbb393bc560313025dcd"
1204+
integrity sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==
1205+
10901206
resolve@^1.10.0:
10911207
version "1.19.0"
10921208
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c"
@@ -1279,6 +1395,16 @@ term-size@^2.1.0:
12791395
resolved "https://registry.yarnpkg.com/term-size/-/term-size-2.2.1.tgz#2a6a54840432c2fb6320fea0f415531e90189f54"
12801396
integrity sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==
12811397

1398+
tiny-invariant@^1.0.2:
1399+
version "1.1.0"
1400+
resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.1.0.tgz#634c5f8efdc27714b7f386c35e6760991d230875"
1401+
integrity sha512-ytxQvrb1cPc9WBEI/HSeYYoGD0kWnGEOR8RY6KomWLBVhqz0RgTwVO9dLrGz7dC+nN9llyI7OKAgRq8Vq4ZBSw==
1402+
1403+
tiny-warning@^1.0.0, tiny-warning@^1.0.3:
1404+
version "1.0.3"
1405+
resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754"
1406+
integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==
1407+
12821408
to-readable-stream@^1.0.0:
12831409
version "1.0.0"
12841410
resolved "https://registry.yarnpkg.com/to-readable-stream/-/to-readable-stream-1.0.0.tgz#ce0aa0c2f3df6adf852efb404a783e77c0475771"
@@ -1391,6 +1517,11 @@ validate-npm-package-license@^3.0.1:
13911517
spdx-correct "^3.0.0"
13921518
spdx-expression-parse "^3.0.0"
13931519

1520+
value-equal@^1.0.1:
1521+
version "1.0.1"
1522+
resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-1.0.1.tgz#1e0b794c734c5c0cade179c437d356d931a34d6c"
1523+
integrity sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==
1524+
13941525
vary@~1.1.2:
13951526
version "1.1.2"
13961527
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"

0 commit comments

Comments
 (0)