Skip to content

Commit 04669a0

Browse files
committed
Updated READMEs
1 parent 93babe0 commit 04669a0

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

README.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,26 @@ This project is a clone of hacker news rewritten with universal Javascript, usin
5151
- Snapshot Testing - (jest)
5252
- Faster Package Install - (yarn)
5353

54+
### Directory Structure
55+
56+
Each directory contains a README.
57+
58+
*root* - Only contains config files such as Babel, ESLint, Docker, Flow, NPM, Yarn, Git.
59+
5460
## How To Start
5561

56-
### One Click Download
62+
### One Click Download & Run
5763

5864
You can download and run the repo with one command to rule them all:
5965

6066
`git clone https://github.com/clintonwoo/hackernews-react-graphql.git && cd hackernews-react-graphql && npm install && npm run dev`
6167

68+
### Execution Path
69+
70+
Server.js is the entry point. It uses Express and passes requests to Next. Next SSR renders the pages using getInitialProps hook from Apollo helper. Therefore the app makes GraphQL requests on the client or server.
71+
72+
When the client receives the page it preloads next page JS designated with <Link prefetch *href=""*>. When the client navigates to the linked page it only needs to make a GraphQL query to render. *Great!*
73+
6274
### Setup
6375

6476
Running the app in dev mode is fully featured including *hot module reloading*:

build/README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
Project build scripts populate this directory for deployment.
22

3-
WARNING: Do not write code in this directory because it will be deleted during builds.
3+
WARNING: Do not write code in this directory because it will be deleted during builds.
4+
5+
### Directory Structure
6+
7+
*build*:
8+
- *app*: App is compiled here using ```npm build```.
9+
- static: Static version of the site is compiled here using ```npm run build-static-website```.

docs/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Directory Structure
2+
3+
*docs* - Contains extra documentation.

src/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### Directory Structure
2+
3+
*src* - Source code
4+
- *\_\_tests__*: Used by Jest in each folder to colocate tests.
5+
- *.next*: Next compiles things here.
6+
- *components*: React reusable components with GraphQL fragments colocated in the file.
7+
- *data*: GraphQL Schema, HN Web APIs, cache, sample data.
8+
- - *models*: Data fetchers. Used to fetch data eg. in GraphQL schema resolvers.
9+
- *helpers*: Helpers for Apollo SSR and calculating 'time ago'.
10+
- *layouts*: Every page uses a layout. It's a React component that can have children put in it.
11+
- *pages*: Every .js file in here contains a React component that is served by Next with the name of the file as a route in the app.
12+
- *static*: Static resources eg. favicon, css, gif.
13+
- *root* contains config files for app and Next. App entry point *server.js*.

0 commit comments

Comments
 (0)