Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/3 #5

Open
wants to merge 76 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
ee9cd27
update readme.md
Jason-Zhang-inAUT Aug 17, 2019
89fb1dd
update readme.md again
Jason-Zhang-inAUT Aug 17, 2019
26b9171
Merge pull request #1 from grr6525/develop
Jason-Zhang-inAUT Aug 17, 2019
b3ba466
change README.md
Jason-Zhang-inAUT Aug 17, 2019
cbd27ca
Merge pull request #2 from grr6525/update-readme
Jason-Zhang-inAUT Aug 17, 2019
483138a
Merge pull request #3 from grr6525/develop
Jason-Zhang-inAUT Aug 17, 2019
a53d2cf
add travis.yml and some test files
Jason-Zhang-inAUT Aug 17, 2019
863478f
only want to CI in mater branch
Jason-Zhang-inAUT Aug 17, 2019
a9ba81f
Merge pull request #4 from grr6525/develop
Jason-Zhang-inAUT Aug 17, 2019
13cd52d
add passing icon
Jason-Zhang-inAUT Aug 17, 2019
7f991e1
Merge pull request #5 from grr6525/develop
Jason-Zhang-inAUT Aug 17, 2019
ed0f444
connet mongoDB in mlab
Jason-Zhang-inAUT Aug 17, 2019
6c8b171
Merge pull request #6 from grr6525/develop
Jason-Zhang-inAUT Aug 17, 2019
20dd6b5
add gitignore and mocha and chai
Jason-Zhang-inAUT Aug 17, 2019
0cf702c
use mocha and chai to test code
Jason-Zhang-inAUT Aug 17, 2019
f12fe2d
Merge pull request #7 from grr6525/develop
Jason-Zhang-inAUT Aug 17, 2019
7de34e1
a simple to use mocha and chai
Jason-Zhang-inAUT Aug 17, 2019
628b4c5
use mocha test
Jason-Zhang-inAUT Aug 18, 2019
d814a15
Merge pull request #8 from grr6525/develop
Jason-Zhang-inAUT Aug 18, 2019
3218bb0
update some details about README.md
Jason-Zhang-inAUT Aug 18, 2019
b1012d2
Update index.js
Jason-Zhang-inAUT Oct 10, 2019
9503775
change some layout
Jason-Zhang-inAUT Oct 10, 2019
e419b1c
#2 feature 2 add if conditions
SanderLiang Oct 10, 2019
0bb7cf7
Merge pull request #10 from grr6525/feature/2
SanderLiang Oct 10, 2019
4638f53
# feature 3
SanderLiang Oct 10, 2019
4061b8e
# feature 3
SanderLiang Oct 10, 2019
e1eb658
Merge pull request #11 from grr6525/feature/2
SanderLiang Oct 10, 2019
aab9398
# feature 2
SanderLiang Oct 10, 2019
d3c5db9
Merge pull request #12 from grr6525/feature/2
SanderLiang Oct 10, 2019
31000ab
change some details of the page
Jason-Zhang-inAUT Oct 10, 2019
215a679
change some spelling mistake
Jason-Zhang-inAUT Oct 10, 2019
0d71417
change the route
Jason-Zhang-inAUT Oct 11, 2019
828978c
search function done
Jason-Zhang-inAUT Oct 11, 2019
33ba726
Merge pull request #13 from grr6525/jasondev
SanderLiang Oct 11, 2019
d81bba0
Merge pull request #9 from grr6525/develop
Jason-Zhang-inAUT Oct 11, 2019
b586e40
multiple queries
Jason-Zhang-inAUT Oct 13, 2019
788580d
fix search problem
Jason-Zhang-inAUT Oct 14, 2019
7881c3f
add detail of search bar
Jason-Zhang-inAUT Oct 14, 2019
9134017
# 1
SanderLiang Oct 15, 2019
223ce7f
Merge pull request #14 from grr6525/jasondev
Jason-Zhang-inAUT Oct 15, 2019
92cbe47
# 1
SanderLiang Oct 15, 2019
4bf342c
change index page
Jason-Zhang-inAUT Oct 15, 2019
99f6e0f
change page title and test commit
Jason-Zhang-inAUT Oct 15, 2019
5ff6302
change url
Jason-Zhang-inAUT Oct 15, 2019
62b6160
# 1
SanderLiang Oct 15, 2019
8068791
add article review
Jason-Zhang-inAUT Oct 16, 2019
72040b5
# 1
SanderLiang Oct 16, 2019
7bdb51d
Merge branch 'feature/1' of https://github.com/grr6525/Node-React-Mon…
SanderLiang Oct 16, 2019
a815dad
# 1
SanderLiang Oct 16, 2019
8598fb6
# 1
SanderLiang Oct 16, 2019
69f354f
article review
Jason-Zhang-inAUT Oct 16, 2019
ef17e72
add test environment
Jason-Zhang-inAUT Oct 16, 2019
c9e881b
# 1
SanderLiang Oct 17, 2019
d1cc4f6
Merge branch 'feature/1' of https://github.com/grr6525/Node-React-Mon…
SanderLiang Oct 17, 2019
70b0d40
add some test code
Jason-Zhang-inAUT Oct 17, 2019
4c23e5a
change package.json
Jason-Zhang-inAUT Oct 17, 2019
b06e878
change package.json
Jason-Zhang-inAUT Oct 17, 2019
b4a9d40
change package.json
Jason-Zhang-inAUT Oct 17, 2019
5f521f5
bug fix
Jason-Zhang-inAUT Oct 17, 2019
6fd71a2
bug fix
Jason-Zhang-inAUT Oct 17, 2019
11cde54
bug fix
Jason-Zhang-inAUT Oct 17, 2019
c870ad7
Merge pull request #15 from grr6525/feature/1
Jason-Zhang-inAUT Oct 17, 2019
f2ee182
# 1
SanderLiang Oct 17, 2019
5e7cad0
# 1
SanderLiang Oct 17, 2019
7da9972
# 1
SanderLiang Oct 17, 2019
9d6d04f
unittest for database opertations
Oct 17, 2019
e37b235
# 1
SanderLiang Oct 17, 2019
5c4d00c
Delete index.js
SanderLiang Oct 17, 2019
55b1c0a
Delete users.js
SanderLiang Oct 17, 2019
f338f28
Merge pull request #16 from grr6525/feature/1
Jason-Zhang-inAUT Oct 17, 2019
98e0042
Merge pull request #17 from grr6525/testchong
Jason-Zhang-inAUT Oct 17, 2019
6cc6ebb
# 3
SanderLiang Oct 20, 2019
e068c6b
# 3
SanderLiang Oct 20, 2019
db03976
# 3
SanderLiang Oct 20, 2019
6c4881a
# 3
SanderLiang Oct 20, 2019
1288f9d
# feature 3
SanderLiang Oct 21, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
../.idea/

npm-debug.log*
yarn-debug.log*
yarn-error.log*
42 changes: 0 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1 @@
## 简介
一个基于 `Node` + `React` + `Webpack` + `MongoDB` 实现的 ToDoList 应用。


## 功能:

- 添加 ToDo
- 删除 ToDo

## 安装
```js
npm install
```

## 启动
```js
mongod --dbpath D:/mongodb/data
```

```js
webpack -w
```

```js
npm start
```

## 相关

**项目和代码分析**

[http://www.cnblogs.com/wx1993/p/6550111.html](http://www.cnblogs.com/wx1993/p/6550111.html?_blank)

**MongoDB 的安装和配置**

Mac:[http://www.cnblogs.com/wx1993/p/5187530.html](http://www.cnblogs.com/wx1993/p/5187530.html?_blank)

Windows:[http://www.cnblogs.com/wx1993/p/5206587.html]([http://www.cnblogs.com/wx1993/p/5206587.html?_blank)

[http://www.cnblogs.com/wx1993/p/6518248.html](http://www.cnblogs.com/wx1993/p/6518248.html?_blank)

## 效果
![](https://camo.githubusercontent.com/3e21821d6a9aefbbdf9b0b3625ae5e6c4e0338d2/687474703a2f2f696d61676573323031352e636e626c6f67732e636f6d2f626c6f672f3738313436342f3230313730332f3738313436342d32303137303332303134323332393533332d313631373830363535362e706e67)
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var index = require('./routes/index');
var users = require('./routes/users');

var mongoose = require('mongoose')
mongoose.connect('mongodb://localhost:27017/todo')
mongoose.connect('mongodb://heroku_bqszzqcw:[email protected]:63927/heroku_bqszzqcw')

var app = express();

Expand Down
90 changes: 0 additions & 90 deletions bin/www

This file was deleted.

91 changes: 91 additions & 0 deletions config/env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
'use strict';

const fs = require('fs');
const path = require('path');
const paths = require('./paths');

// Make sure that including paths.js after env.js will read .env variables.
delete require.cache[require.resolve('./paths')];

const NODE_ENV = process.env.NODE_ENV;
if (!NODE_ENV) {
throw new Error(
'The NODE_ENV environment variable is required but was not specified.'
);
}

// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
var dotenvFiles = [
`${paths.dotenv}.${NODE_ENV}.local`,
`${paths.dotenv}.${NODE_ENV}`,
// Don't include `.env.local` for `test` environment
// since normally you expect tests to produce the same
// results for everyone
NODE_ENV !== 'test' && `${paths.dotenv}.local`,
paths.dotenv,
].filter(Boolean);

// Load environment variables from .env* files. Suppress warnings using silent
// if this file is missing. dotenv will never modify any environment variables
// that have already been set.
// https://github.com/motdotla/dotenv
dotenvFiles.forEach(dotenvFile => {
if (fs.existsSync(dotenvFile)) {
require('dotenv').config({
path: dotenvFile,
});
}
});

// We support resolving modules according to `NODE_PATH`.
// This lets you use absolute paths in imports inside large monorepos:
// https://github.com/facebookincubator/create-react-app/issues/253.
// It works similar to `NODE_PATH` in Node itself:
// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
// https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421
// We also resolve them to make sure all tools using them work consistently.
const appDirectory = fs.realpathSync(process.cwd());
process.env.NODE_PATH = (process.env.NODE_PATH || '')
.split(path.delimiter)
.filter(folder => folder && !path.isAbsolute(folder))
.map(folder => path.resolve(appDirectory, folder))
.join(path.delimiter);

// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
// injected into the application via DefinePlugin in Webpack configuration.
const REACT_APP = /^REACT_APP_/i;

function getClientEnvironment(publicUrl) {
const raw = Object.keys(process.env)
.filter(key => REACT_APP.test(key))
.reduce(
(env, key) => {
env[key] = process.env[key];
return env;
},
{
// Useful for determining whether we’re running in production mode.
// Most importantly, it switches React into the correct mode.
NODE_ENV: process.env.NODE_ENV || 'development',
// Useful for resolving the correct path to static assets in `public`.
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
// This should only be used as an escape hatch. Normally you would put
// images into the `src` and `import` them in code to get their paths.
PUBLIC_URL: publicUrl,
connect_database:''
}
);
// Stringify all values so we can feed into Webpack DefinePlugin
const stringified = {
'process.env': Object.keys(raw).reduce((env, key) => {
env[key] = JSON.stringify(raw[key]);
return env;
}, {}),
};

return { raw, stringified };
}

module.exports = getClientEnvironment;
14 changes: 14 additions & 0 deletions config/jest/cssTransform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

// This is a custom Jest transformer turning style imports into empty objects.
// http://facebook.github.io/jest/docs/tutorial-webpack.html

module.exports = {
process() {
return 'module.exports = {};';
},
getCacheKey() {
// The output is always the same.
return 'cssTransform';
},
};
12 changes: 12 additions & 0 deletions config/jest/fileTransform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

const path = require('path');

// This is a custom Jest transformer turning file imports into filenames.
// http://facebook.github.io/jest/docs/tutorial-webpack.html

module.exports = {
process(src, filename) {
return `module.exports = ${JSON.stringify(path.basename(filename))};`;
},
};
55 changes: 55 additions & 0 deletions config/paths.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
'use strict';

const path = require('path');
const fs = require('fs');
const url = require('url');

// Make sure any symlinks in the project folder are resolved:
// https://github.com/facebookincubator/create-react-app/issues/637
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);

const envPublicUrl = process.env.PUBLIC_URL;

function ensureSlash(path, needsSlash) {
const hasSlash = path.endsWith('/');
if (hasSlash && !needsSlash) {
return path.substr(path, path.length - 1);
} else if (!hasSlash && needsSlash) {
return `${path}/`;
} else {
return path;
}
}

const getPublicUrl = appPackageJson =>
envPublicUrl || require(appPackageJson).homepage;

// We use `PUBLIC_URL` environment variable or "homepage" field to infer
// "public path" at which the app is served.
// Webpack needs to know it to put the right <script> hrefs into HTML even in
// single-page apps that may serve index.html for nested URLs like /todos/42.
// We can't use a relative path in HTML because we don't want to load something
// like /todos/42/static/js/bundle.7289d.js. We have to know the root.
function getServedPath(appPackageJson) {
const publicUrl = getPublicUrl(appPackageJson);
const servedUrl =
envPublicUrl || (publicUrl ? url.parse(publicUrl).pathname : '/');
return ensureSlash(servedUrl, true);
}

// config after eject: we're in ./config/
module.exports = {
dotenv: resolveApp('.env'),
appBuild: resolveApp('build'),
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appIndexJs: resolveApp('src/index.js'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src'),
yarnLockFile: resolveApp('yarn.lock'),
testsSetup: resolveApp('src/setupTests.js'),
appNodeModules: resolveApp('node_modules'),
publicUrl: getPublicUrl(resolveApp('package.json')),
servedPath: getServedPath(resolveApp('package.json')),
};
16 changes: 16 additions & 0 deletions config/polyfills.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

if (typeof Promise === 'undefined') {
// Rejection tracking prevents a common issue where React gets into an
// inconsistent state due to an error, but it gets swallowed by a Promise,
// and the user has no idea what causes React's erratic future behavior.
require('promise/lib/rejection-tracking').enable();
window.Promise = require('promise/lib/es6-extensions.js');
}

// fetch() polyfill for making API calls.
require('whatwg-fetch');

// Object.assign() is commonly used with React.
// It will use the native implementation if it's present and isn't buggy.
Object.assign = require('object-assign');
Loading