You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-23Lines changed: 23 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ To get the frontend running locally:
15
15
16
16
- Clone this repo
17
17
-`npm install` to install all req'd dependencies
18
-
-`npm run watch` to have webpack bundle the JS files into /bin/main.js, then run `npm start`
18
+
-`npm start` to start the local server (this project uses create-react-app)
19
19
20
20
For convenience, we have a live API server running at https://conduit.productionready.io/api for the application to make requests against. You can view [the API spec here](https://github.com/GoThinkster/productionready/blob/master/API.md) which contains all routes & responses for the server. We'll release the backend code in a few weeks should anyone be interested in it.
21
21
@@ -57,7 +57,7 @@ The example application is a social blogging site (i.e. a Medium.com clone) call
57
57
58
58
This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).
59
59
60
-
Below you will find some information on how to perform common tasks.
60
+
Below you will find some information on how to perform common tasks.
61
61
You can find the most recent version of this guide [here](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md).
62
62
63
63
## Table of Contents
@@ -156,13 +156,13 @@ For the project to build, **these files must exist with exact filenames**:
156
156
157
157
You can delete or rename the other files.
158
158
159
-
You may create subdirectories inside `src`. For faster rebuilds, only files inside `src` are processed by Webpack.
159
+
You may create subdirectories inside `src`. For faster rebuilds, only files inside `src` are processed by Webpack.
160
160
You need to **put any JS and CSS files inside `src`**, or Webpack won’t see them.
161
161
162
-
Only files inside `public` can be used from `public/index.html`.
162
+
Only files inside `public` can be used from `public/index.html`.
163
163
Read instructions below for using assets from JavaScript and HTML.
164
164
165
-
You can, however, create more top-level directories.
165
+
You can, however, create more top-level directories.
166
166
They will not be included in the production build so you can use them for things like documentation.
167
167
168
168
## Available Scripts
@@ -179,7 +179,7 @@ You will also see any lint errors in the console.
179
179
180
180
### `npm test`
181
181
182
-
Launches the test runner in the interactive watch mode.
182
+
Launches the test runner in the interactive watch mode.
183
183
See the section about [running tests](#running-tests) for more information.
This project setup supports ES6 modules thanks to Babel.
248
+
This project setup supports ES6 modules thanks to Babel.
249
249
While you can still use `require()` and `module.exports`, we encourage you to use [`import` and `export`](http://exploringjs.com/es6/ch_modules.html) instead.
250
250
251
251
For example:
@@ -393,7 +393,7 @@ Webpack finds all relative module references in CSS (they start with `./`) and r
393
393
394
394
Please be advised that this is also a custom feature of Webpack.
395
395
396
-
**It is not required for React** but many people enjoy it (and React Native uses a similar mechanism for images).
396
+
**It is not required for React** but many people enjoy it (and React Native uses a similar mechanism for images).
397
397
An alternative way of handling static assets is described in the next section.
398
398
399
399
## Using the `public` Folder
@@ -418,7 +418,7 @@ Inside `index.html`, you can use it like this:
418
418
419
419
Only files inside the `public` folder will be accessible by `%PUBLIC_URL%` prefix. If you need to use a file from `src` or `node_modules`, you’ll have to copy it there to explicitly specify your intention to make this file a part of the build.
420
420
421
-
When you run `npm run build`, Create React App will substitute `%PUBLIC_URL%` with a correct absolute path so your project works even if you use client-side routing or host it at a non-root URL.
421
+
When you run `npm run build`, Create React App will substitute `%PUBLIC_URL%` with a correct absolute path so your project works even if you use client-side routing or host it at a non-root URL.
422
422
423
423
In JavaScript code, you can use `process.env.PUBLIC_URL` for similar purposes:
424
424
@@ -573,22 +573,22 @@ To define permanent environment vairables, create a file called `.env` in the ro
573
573
REACT_APP_SECRET_CODE=abcdef
574
574
```
575
575
576
-
These variables will act as the defaults if the machine does not explicitly set them.
576
+
These variables will act as the defaults if the machine does not explicitly set them.
577
577
Please refer to the [dotenv documentation](https://github.com/motdotla/dotenv) for more details.
578
578
579
579
>Note: If you are defining environment variables for development, your CI and/or hosting platform will most likely need
580
580
these defined as well. Consult their documentation how to do this. For example, see the documentation for [Travis CI](https://docs.travis-ci.com/user/environment-variables/) or [Heroku](https://devcenter.heroku.com/articles/config-vars).
581
581
582
582
## Can I Use Decorators?
583
583
584
-
Many popular libraries use [decorators](https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841) in their documentation.
584
+
Many popular libraries use [decorators](https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841) in their documentation.
585
585
Create React App doesn’t support decorator syntax at the moment because:
586
586
587
587
* It is an experimental proposal and is subject to change.
588
588
* The current specification version is not officially supported by Babel.
589
589
* If the specification changes, we won’t be able to write a codemod because we don’t use them internally at Facebook.
590
590
591
-
However in many cases you can rewrite decorator-based code without decorators just as fine.
591
+
However in many cases you can rewrite decorator-based code without decorators just as fine.
@@ -604,7 +604,7 @@ Check out [this tutorial](https://www.fullstackreact.com/articles/using-create-r
604
604
605
605
>Note: this feature is available with `[email protected]` and higher.
606
606
607
-
People often serve the front-end React app from the same host and port as their backend implementation.
607
+
People often serve the front-end React app from the same host and port as their backend implementation.
608
608
For example, a production setup might look like this after the app is deployed:
609
609
610
610
```
@@ -631,7 +631,7 @@ Fetch API cannot load http://localhost:4000/api/todos. No 'Access-Control-Allow-
631
631
632
632
Keep in mind that `proxy` only has effect in development (with `npm start`), and it is up to you to ensure that URLs like `/api/todos` point to the right thing in production. You don’t have to use the `/api` prefix. Any unrecognized request without a `text/html` accept header will be redirected to the specified `proxy`.
633
633
634
-
Currently the `proxy` option only handles HTTP requests, and it won’t proxy WebSocket connections.
634
+
Currently the `proxy` option only handles HTTP requests, and it won’t proxy WebSocket connections.
635
635
If the `proxy` option is **not** flexible enough for you, alternatively you can:
636
636
637
637
* Enable CORS on your server ([here’s how to do it for Express](http://enable-cors.org/server_expressjs.html)).
@@ -679,7 +679,7 @@ If you use a Node server, you can even share the route matching logic between th
679
679
680
680
## Running Tests
681
681
682
-
>Note: this feature is available with `[email protected]` and higher.
682
+
>Note: this feature is available with `[email protected]` and higher.
683
683
>[Read the migration guide to learn how to enable it in older projects!](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md#migrating-from-023-to-030)
684
684
685
685
Create React App uses [Jest](https://facebook.github.io/jest/) as its test runner. To prepare for this integration, we did a [major revamp](https://facebook.github.io/jest/blog/2016/09/01/jest-15.html) of Jest so if you heard bad things about it years ago, give it another try.
@@ -733,7 +733,7 @@ it('sums numbers', () => {
733
733
});
734
734
```
735
735
736
-
All `expect()` matchers supported by Jest are [extensively documented here](http://facebook.github.io/jest/docs/api.html#expect-value).
736
+
All `expect()` matchers supported by Jest are [extensively documented here](http://facebook.github.io/jest/docs/api.html#expect-value).
737
737
You can also use [`jest.fn()` and `expect(fn).toBeCalled()`](http://facebook.github.io/jest/docs/api.html#tobecalled) to create “spies” or mock functions.
@@ -894,7 +894,7 @@ By default, the `package.json` of the generated project looks like this:
894
894
}
895
895
```
896
896
897
-
If you know that none of your tests depend on [jsdom](https://github.com/tmpvar/jsdom), you can safely remove `--env=jsdom`, and your tests will run faster.
897
+
If you know that none of your tests depend on [jsdom](https://github.com/tmpvar/jsdom), you can safely remove `--env=jsdom`, and your tests will run faster.
898
898
To help you make up your mind, here is a list of APIs that **need jsdom**:
899
899
900
900
* Any browser globals like `window` and `document`
@@ -919,7 +919,7 @@ This feature is experimental and still [has major usage issues](https://github.c
919
919
920
920
## Building for Relative Paths
921
921
922
-
By default, Create React App produces a build assuming your app is hosted at the server root.
922
+
By default, Create React App produces a build assuming your app is hosted at the server root.
923
923
To override this, specify the `homepage` in your `package.json`, for example:
924
924
925
925
```js
@@ -938,7 +938,7 @@ Open your `package.json` and add a `homepage` field:
938
938
"homepage": "http://myusername.github.io/my-app",
939
939
```
940
940
941
-
**The above step is important!**
941
+
**The above step is important!**
942
942
Create React App uses the `homepage` field to determine the root URL in the built HTML file.
943
943
944
944
Now, whenever you run `npm run build`, you will see a cheat sheet with a sequence of commands to deploy to GitHub pages:
@@ -961,7 +961,7 @@ Note that GitHub Pages doesn't support routers that use the HTML5 `pushState` hi
961
961
962
962
### Heroku
963
963
964
-
Use the [Heroku Buildpack for Create React App](https://github.com/mars/create-react-app-buildpack).
964
+
Use the [Heroku Buildpack for Create React App](https://github.com/mars/create-react-app-buildpack).
965
965
You can find instructions in [Deploying React with Zero Configuration](https://blog.heroku.com/deploying-react-with-zero-configuration).
0 commit comments