https://github.com/kamleshchandnani/progressivewebapp
https://github.com/kamleshchandnani/progressivewebapp
Last synced: 29 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/kamleshchandnani/progressivewebapp
- Owner: kamleshchandnani
- Created: 2017-02-19T12:20:50.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-19T12:24:07.000Z (about 8 years ago)
- Last Synced: 2025-03-26T20:56:58.543Z (about 1 month ago)
- Language: JavaScript
- Size: 209 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

# react-redux TODOA simple Progressive Web App(PWA) TODO made on top of react, Material Design, IndexedDB and localStorage with service-workers.
## Installation
Download or clone the project:
```
npm install
npm start
```## Folder Structure
The project structure will look like this:
```
todo-rooms/
README.md
yarn.lock
node_modules/
package.json
public/
index.html
favicon.ico
src/
actions/
components/
containers/
middleware/
pages/
reducers/
store/
styles/
utilities/
index.js
routes.js
```For the project to build, **these files must exist with exact filenames**:
* `public/index.html` is the page template;
* `src/index.js` is the JavaScript entry point.You can delete or rename the other files.
## Usage
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.The page will reload if you make edits.
You will also see any lint errors in the console.### `npm test`
Launches the test runner in the interactive watch mode.
See the section about [running tests](#running-tests) for more information.### `npm run build`
Builds the app for production to the `build` folder.
It correctly bundles React in production mode and optimizes the build for the best performance.The build is minified and the filenames include the hashes.
Your app is ready to be deployed!## Support
Please [open an issue](https://github.com/kakadiadarpan/todo-rooms/issues/new) for support.
## Making a Progressive Web App
You can turn your React app into a [Progressive Web App](https://developers.google.com/web/progressive-web-apps/) by following the steps in [this repository](https://github.com/jeffposnick/create-react-pwa).
### GitHub Pages
>Note: this feature is available with `[email protected]` and higher.
#### Step 1: Add `homepage` to `package.json`
**The step below is important!**
**If you skip it, your app will not deploy correctly.**Open your `package.json` and add a `homepage` field:
```js
"homepage": "https://myusername.github.io/my-app",
```Create React App uses the `homepage` field to determine the root URL in the built HTML file.
#### Step 2: Install `gh-pages` and add `deploy` to `scripts` in `package.json`
Now, whenever you run `npm run build`, you will see a cheat sheet with instructions on how to deploy to GitHub Pages.
To publish it at [https://myusername.github.io/my-app](https://myusername.github.io/my-app), run:
```sh
npm install --save-dev gh-pages
```Add the following script in your `package.json`:
```js
// ...
"scripts": {
// ...
"deploy": "npm run build&&gh-pages -d build"
}
```(Note: the lack of whitespace is intentional.)
#### Step 3: Deploy the site by running `npm run deploy`
Then run:
```sh
npm run deploy
```#### Step 4: Ensure your project's settings use `gh-pages`
Finally, make sure **GitHub Pages** option in your GitHub project settings is set to use the `gh-pages` branch:
#### Step 5: Optionally, configure the domain
You can configure a custom domain with GitHub Pages by adding a `CNAME` file to the `public/` folder.
#### Notes on client-side routing
GitHub Pages doesn't support routers that use the HTML5 `pushState` history API under the hood (for example, React Router using `browserHistory`). This is because when there is a fresh page load for a url like `http://user.github.io/todomvc/todos/42`, where `/todos/42` is a frontend route, the GitHub Pages server returns 404 because it knows nothing of `/todos/42`. If you want to add a router to a project hosted on GitHub Pages, here are a couple of solutions:
* You could switch from using HTML5 history API to routing with hashes. If you use React Router, you can switch to `hashHistory` for this effect, but the URL will be longer and more verbose (for example, `http://user.github.io/todomvc/#/todos/42?_k=yknaj`). [Read more](https://github.com/reactjs/react-router/blob/master/docs/guides/Histories.md#histories) about different history implementations in React Router.
* Alternatively, you can use a trick to teach GitHub Pages to handle 404 by redirecting to your `index.html` page with a special redirect parameter. You would need to add a `404.html` file with the redirection code to the `build` folder before deploying your project, and you’ll need to add code handling the redirect parameter to `index.html`. You can find a detailed explanation of this technique [in this guide](https://github.com/rafrex/spa-github-pages).### Heroku
Use the [Heroku Buildpack for Create React App](https://github.com/mars/create-react-app-buildpack).
You can find instructions in [Deploying React with Zero Configuration](https://blog.heroku.com/deploying-react-with-zero-configuration).