Skip to content

Commit cb03521

Browse files
committed
Updated README.md to provide project set up instructions, renamed endpoint 'route' to 'link' in server index
1 parent 37094db commit cb03521

2 files changed

Lines changed: 42 additions & 7 deletions

File tree

README.md

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# dogs
22

3-
This is the starter code for a [Node.js](https://nodejs.org/en/about/) server
4-
using the [Koa web framework](https://koajs.com/). There a web page in
5-
`/public` which should be served to the user.
3+
This is a [Node.js](https://nodejs.org/en/about/) web application
4+
using the [Koa](https://koajs.com/) and [React](https://reactjs.org/)
5+
web frameworks.
66

77
## Getting started
88

@@ -17,24 +17,59 @@ $ node --version
1717
v16.17.0
1818
```
1919

20-
Then, inside this project, run
20+
Open two terminal sessions. They will be for running the
21+
frontend and backend separately.
2122

23+
To start up the server in the backend,
2224
```sh
25+
cd app/backend
2326
npm install
2427
node server.js
2528
```
2629

2730
If the server starts successfully, you will see
28-
2931
```sh
3032
Server running on http://localhost:3011
3133
```
3234

3335
in the terminal.
3436

37+
38+
To start up the frontend run
39+
```sh
40+
cd app/frontend
41+
npm install
42+
npm run start
43+
```
44+
in your other terminal tab.
45+
46+
Note that `npm install` in this case will result in a few **high severity vulnerabilities** being discovered.
47+
However, this is just a false positive which you can read more about from a Meta engineer himself [here](https://github.com/facebook/create-react-app/issues/11174)
48+
49+
If the server starts successfully, you will see
50+
```
51+
You can now view dogs in the browser.
52+
53+
Local: http://localhost:3000
54+
On Your Network: http://networkaddress:3000
55+
56+
Note that the development build is not optimized.
57+
To create a production build, use npm run build.
58+
59+
webpack compiled successfully
60+
```
61+
62+
## In your browser
63+
Once both servers are started, you can navigate to: <br />
64+
1. Application website - http://localhost:3000
65+
2. Server w/ endpoints - http://localhost:3011
66+
67+
3568
## Documentation
3669

3770
- Koa: https://koajs.com/
3871
- @koa/router: https://github.com/koajs/router#koarouter
3972
- koa-body: https://github.com/dlau/koa-body#usage-with-koa-router
4073
- Dogs API: https://dog.ceo/dog-api/breeds-list
74+
- React.js: https://reactjs.org/docs/getting-started.html
75+
- React Router: https://reactrouter.com/en/main

app/backend/server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ app.use(cors({origin: '*'}));
1313
router.get('/', (ctx) => {
1414
ctx.body = {'Server\'s API Endpoints': {
1515
'Getting random dog image': {
16-
'link' : '/dog/get-random',
16+
'route' : '/dog/get-random',
1717
'example' : 'http://localhost:3011/dog/get-random'},
1818
'Getting random images by breed': {
19-
'link' : '/dog/:breed/:subBreed/get-images/:amount',
19+
'route' : '/dog/:breed/:subBreed/get-images/:amount',
2020
'example' : 'http://localhost:3011/dog/retriever/golden/get-images/50'}
2121
}};
2222
});

0 commit comments

Comments
 (0)