Skip to content

Commit 4b4fc37

Browse files
committedOct 4, 2019
Project setup: routers setup and update README
1 parent 230462d commit 4b4fc37

19 files changed

+139
-282
lines changed
 

‎.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@
2121
npm-debug.log*
2222
yarn-debug.log*
2323
yarn-error.log*
24+
25+
.idea

‎README.md

+26-68
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,26 @@
1-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2-
3-
## Available Scripts
4-
5-
In the project directory, you can run:
6-
7-
### `npm start`
8-
9-
Runs the app in the development mode.<br />
10-
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
11-
12-
The page will reload if you make edits.<br />
13-
You will also see any lint errors in the console.
14-
15-
### `npm test`
16-
17-
Launches the test runner in the interactive watch mode.<br />
18-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
19-
20-
### `npm run build`
21-
22-
Builds the app for production to the `build` folder.<br />
23-
It correctly bundles React in production mode and optimizes the build for the best performance.
24-
25-
The build is minified and the filenames include the hashes.<br />
26-
Your app is ready to be deployed!
27-
28-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
29-
30-
### `npm run eject`
31-
32-
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
33-
34-
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
35-
36-
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
37-
38-
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
39-
40-
## Learn More
41-
42-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
43-
44-
To learn React, check out the [React documentation](https://reactjs.org/).
45-
46-
### Code Splitting
47-
48-
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
49-
50-
### Analyzing the Bundle Size
51-
52-
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
53-
54-
### Making a Progressive Web App
55-
56-
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
57-
58-
### Advanced Configuration
59-
60-
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
61-
62-
### Deployment
63-
64-
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
65-
66-
### `npm run build` fails to minify
67-
68-
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
1+
## Routes
2+
###
3+
+ /
4+
+ list of all goods
5+
6+
+ /goods/:goodsId
7+
+ information of a particular goods
8+
9+
+ /order/:orderId
10+
+ information of a particular order
11+
12+
+ /user/:userId
13+
+ personal information
14+
+ selling goods list
15+
+ order list
16+
17+
+ /administer
18+
+ list of all users
19+
+ list of all orders
20+
+ list of all goods
21+
22+
+ /login
23+
+ login page
24+
25+
+ /register
26+
+ register page

‎package-lock.json

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6+
"axios": "^0.19.0",
67
"react": "^16.10.1",
78
"react-dom": "^16.10.1",
9+
"react-router-dom": "^5.1.2",
810
"react-scripts": "3.2.0"
911
},
1012
"scripts": {
@@ -27,5 +29,8 @@
2729
"last 1 firefox version",
2830
"last 1 safari version"
2931
]
32+
},
33+
"devDependencies": {
34+
"prettier": "1.18.2"
3035
}
3136
}

‎src/App.css

-22
This file was deleted.

‎src/App.js

-26
This file was deleted.

‎src/App.test.js

-9
This file was deleted.

‎src/components/App.js

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import React from 'react';
2+
import { Router, Route, Switch } from 'react-router-dom';
3+
import { createBrowserHistory } from 'history';
4+
5+
import Goods from './goods/index';
6+
import GoodsDetail from './goods/GoodsDetail';
7+
import Order from './order/index';
8+
import User from './user/index';
9+
import Administer from './administer/index';
10+
import Login from './login/index';
11+
import Register from './register/index';
12+
13+
class App extends React.Component {
14+
render() {
15+
// Global routes settings
16+
return (
17+
<div>
18+
<Router history={createBrowserHistory()}>
19+
<Switch />
20+
<Route path="/" exact component={Goods} />
21+
<Route path="/goods" exact component={Goods} />
22+
<Route path="/goods/:goodsId" exact component={GoodsDetail} />
23+
<Route path="/order" exact component={Order} />
24+
<Route path="/user/:userId" exact component={User} />
25+
<Route path="/administer" exact component={Administer} />
26+
<Route path="/login" exact component={Login} />
27+
<Route path="/register" exact component={Register} />
28+
</Router>
29+
</div>
30+
);
31+
}
32+
}
33+
34+
export default App;

‎src/components/administer/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
3+
class Administer extends React.Component {
4+
render() {
5+
return <h1>Administer page</h1>;
6+
}
7+
}
8+
9+
export default Administer;

‎src/components/goods/GoodsDetail.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
3+
class GoodsDetail extends React.Component {
4+
render() {
5+
// Get params in url
6+
return <h1>Goods detail for id: {this.props.match.params.goodsId}</h1>;
7+
}
8+
}
9+
10+
export default GoodsDetail;

‎src/components/goods/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
3+
class Goods extends React.Component {
4+
render() {
5+
return <h1>Goods page</h1>;
6+
}
7+
}
8+
9+
export default Goods;

‎src/components/login/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
3+
class Login extends React.Component {
4+
render() {
5+
return <h1>Login page</h1>;
6+
}
7+
}
8+
9+
export default Login;

‎src/components/order/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
3+
class Order extends React.Component {
4+
render() {
5+
return <h1>Order page</h1>;
6+
}
7+
}
8+
9+
export default Order;

‎src/components/register/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
3+
class Register extends React.Component {
4+
render() {
5+
return <h1>Register page</h1>;
6+
}
7+
}
8+
9+
export default Register;

‎src/components/user/index.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
3+
class User extends React.Component {
4+
render() {
5+
// Get params in url
6+
return <h1>User page for user Id: {this.props.match.params.userId}</h1>;
7+
}
8+
}
9+
10+
export default User;

‎src/index.css

-13
This file was deleted.

‎src/index.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3-
import './index.css';
4-
import App from './App';
5-
import * as serviceWorker from './serviceWorker';
3+
import App from './components/App';
64

75
ReactDOM.render(<App />, document.getElementById('root'));
8-
9-
// If you want your app to work offline and load faster, you can change
10-
// unregister() to register() below. Note this comes with some pitfalls.
11-
// Learn more about service workers: https://bit.ly/CRA-PWA
12-
serviceWorker.unregister();

‎src/logo.svg

-1
This file was deleted.

‎src/serviceWorker.js

-135
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.