Skip to content

Commit

Permalink
add millio.js
Browse files Browse the repository at this point in the history
  • Loading branch information
flyfishzy committed Jan 27, 2024
1 parent cfbb0b1 commit dd13f43
Show file tree
Hide file tree
Showing 50 changed files with 15,176 additions and 0 deletions.
22 changes: 22 additions & 0 deletions app/million-realworld-example-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
node_modules

# testing
coverage
.nyc_output

# production
build

# misc
.DS_Store
.env
npm-debug.log
.idea

.eslintcache

cypress/videos
cypress/screenshots
3 changes: 3 additions & 0 deletions app/million-realworld-example-app/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
74 changes: 74 additions & 0 deletions app/million-realworld-example-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Million Example App
[![Netlify Status](https://api.netlify.com/api/v1/badges/aa569c8f-ebd5-413e-9fb2-e34facc71873/deploy-status)](https://app.netlify.com/sites/react-redux-realworld/deploys)
[![RealWorld Frontend](https://img.shields.io/badge/realworld-frontend-%23783578.svg)](http://realworld.io)

> ### React + Redux codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the [RealWorld](https://github.com/gothinkster/realworld-example-apps) spec and API.
<a href="https://stackblitz.com/edit/react-redux-realworld" target="_blank"><img width="187" src="https://github.com/gothinkster/realworld/blob/master/media/edit_on_blitz.png?raw=true" /></a>&nbsp;&nbsp;<a href="https://thinkster.io/tutorials/build-a-real-world-react-redux-application" target="_blank"><img width="384" src="https://raw.githubusercontent.com/gothinkster/realworld/master/media/learn-btn-hr.png" /></a>

### [Demo](https://react-redux-realworld.netlify.app/)&nbsp;&nbsp;&nbsp;&nbsp;[RealWorld](https://github.com/gothinkster/realworld)

Originally created for this [GH issue](https://github.com/reactjs/redux/issues/1353). The codebase is now feature complete; please submit bug fixes via pull requests & feedback via issues.

We also have notes in [**our wiki**](https://github.com/khaledosman/react-redux-realworld-example-app/wiki) about how the various patterns used in this codebase and how they work (thanks [@thejmazz](https://github.com/thejmazz)!)


## Getting started

You can view a live demo over at https://react-redux-realworld.netlify.app/

To get the frontend running locally:

- Clone this repo
- `npm install` to install all req'd dependencies
- `npm start` to start the local server (this project uses create-react-app)

Local web server will use port 4100 instead of standard React's port 3000 to prevent conflicts with some backends like Node or Rails. You can configure port in scripts section of `package.json`: we use [cross-env](https://github.com/kentcdodds/cross-env) to set environment variable PORT for React scripts, this is Windows-compatible way of setting environment variables.

Alternatively, you can add `.env` file in the root folder of project to set environment variables (use PORT to change webserver's port). This file will be ignored by git, so it is suitable for API keys and other sensitive stuff. Refer to [dotenv](https://github.com/motdotla/dotenv) and [React](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#adding-development-environment-variables-in-env) documentation for more details. Also, please remove setting variable via script section of `package.json` - `dotenv` never override variables if they are already set.

### Making requests to the backend API

For convenience, we have a live API server running at https://api.realworld.io/api for the application to make requests against. You can view [the API spec here](https://github.com/GoThinkster/productionready/blob/master/api) which contains all routes & responses for the server.

The source code for the backend server (available for Node, Rails and Django) can be found in the [main RealWorld repo](https://github.com/gothinkster/realworld).

If you want to change the API URL to a local server, start/build the app with the REACT_APP_BACKEND_URL environment variable pointing to the local server's URL (i.e. `REACT_APP_BACKEND_URL="http://localhost:3000/api" npm run build`)


## Functionality overview

The example application is a social blogging site (i.e. a Medium.com clone) called "Conduit". It uses a custom API for all requests, including authentication. You can view a live demo over at https://redux.productionready.io/

**General functionality:**

- Authenticate users via JWT (login/signup pages + logout button on settings page)
- CRU* users (sign up & settings page - no deleting required)
- CRUD Articles
- CR*D Comments on articles (no updating required)
- GET and display paginated lists of articles
- Favorite articles
- Follow other users

**The general page breakdown looks like this:**

- Home page (URL: /#/ )
- List of tags
- List of articles pulled from either Feed, Global, or by Tag
- Pagination for list of articles
- Sign in/Sign up pages (URL: /#/login, /#/register )
- Use JWT (store the token in localStorage)
- Settings page (URL: /#/settings )
- Editor page to create/edit articles (URL: /#/editor, /#/editor/article-slug-here )
- Article page (URL: /#/article/article-slug-here )
- Delete article button (only shown to article's author)
- Render markdown from server client side
- Comments section at bottom of page
- Delete comment button (only shown to comment's author)
- Profile page (URL: /#/@username, /#/@username/favorites )
- Show basic user info
- List of articles populated from author's created articles or author's favorited articles

<br />

[![Brought to you by Thinkster](https://raw.githubusercontent.com/gothinkster/realworld/master/media/end.png)](https://thinkster.io)
7 changes: 7 additions & 0 deletions app/million-realworld-example-app/craco.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const million = require("million/compiler");

module.exports = {
webpack: {
plugins: { add: [million.webpack({ auto: true })] },
},
};
47 changes: 47 additions & 0 deletions app/million-realworld-example-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "react-redux-realworld-example-app",
"version": "0.1.0",
"private": true,
"devDependencies": {
"cross-env": "^7.0.3",
"faker": "^6.6.6",
"jest-fetch-mock": "^3.0.3",
"node-fetch": "^3.3.1",
"prettier": "^2.8.8",
"pretty-quick": "^3.1.3",
"react-scripts": "^5.0.1",
"redux-testkit": "^1.0.6",
"start-server-and-test": "^2.0.0"
},
"dependencies": {
"@craco/craco": "^7.1.0",
"@reduxjs/toolkit": "^1.9.5",
"history": "^5.3.0",
"marked": "^5.0.2",
"million": "^2.6.4",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-redux": "^8.0.5",
"react-router": "^6.11.1",
"react-router-dom": "^6.11.1",
"redux": "^4.2.1",
"redux-logger": "^3.0.6",
"snarkdown": "^2.0.0",
"superagent": "^8.0.9",
"superagent-promise": "^1.1.0",
"xss": "^1.0.14"
},
"scripts": {
"start": "cross-env PORT=4100 craco start",
"build": "craco build",
"test": "cross-env PORT=4100 craco test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
Loading

0 comments on commit dd13f43

Please sign in to comment.