Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 34 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,38 @@
## What's inside
## HW1 (Comments)

It is an empty React project created for the code review
purposes on the React course in MIPT (2021).
+ request ```/``` is empty (now are available:
+ ```/boards```
+ ```/{board's key}```

## Pull requests

For everyone who wants to send homework for the code review
a special branch is created. The name of each branch looks
like `homework/<username>`.

At the first step, you need to make a `fork` of the repository
and continue inside your own copy.

When you have smth for the review, you should make a Pull
request from your repository into `obabichev:homework/<username>`.

After that PR will be reviewed and scored, and the table with ratings updated (or not updated.. ^_^).

## Run project

This project was created with `create-react-app`. So all
the scripts are the same including `npm start`,
`npm run build`.

## Connect to the server

If you try to connect to the server
you may get an error related to the CORS policy. It happens
because you run the website on one domain (for example
`localhost`), but try to make a request to the other (for
example `https://431243-co32399.tmweb.ru`).

The easiest way to avoid this problem is to use proxy
possibilities of the server create-react-app runs for you.

Just add a field `proxy` with the server url in `package.json`:

```json
{
...
"proxy": "https://431243-co32399.tmweb.ru"
}
```

## Swagger

You can find the description of available API in the swagger documentation:
+ this script:
```
https://431243-co32399.tmweb.ru/swagger/
<Route path="/TB1" component={() => Tasks(data1)}/>
<Route path="/TB2" component={() => Tasks(data2)}/>
<Route path="/TB3" component={() => Tasks(data3)}/>
<Route path="/CTS" component={() => Tasks(data4)}/>
```
(I use 4 urls instead of single one, because component choosing depends on json(not on board's key), but, of cource, I can write converter (board's key => json)
## HW2(Comments)

+ bug fixes of HW1

+ new Urls:
+ ```/boards```
+ ```/board/:key```

+ Integration with the server (+loaging state , +error state)
```js
const [dat, setResBody] = useState([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
useEffect(() => {
fetch(url)
.then(resp => resp.json())
.then(data => setResBody(data))
.catch((e) => setError(e.message))
.finally(() => setLoading(false));
}, [url]);

return [dat, loading, error];

```

## Bugs

If you find any problems in the API implementation I would be happy to know about it.
I promise extra points for the found issues and PRs with bugfixes ^_^.
Loading