Skip to content

Commit 1135cb5

Browse files
committed
Rendering on the server
0 parents  commit 1135cb5

26 files changed

+10272
-0
lines changed

.eslintrc.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module.exports = {
2+
parser: 'babel-eslint',
3+
env: {
4+
browser: true,
5+
commonjs: true,
6+
es6: true,
7+
node: true,
8+
jest: true
9+
},
10+
extends: ['eslint:recommended', 'plugin:react/recommended'],
11+
parserOptions: {
12+
ecmaFeatures: {
13+
jsx: true
14+
},
15+
sourceType: 'module'
16+
},
17+
plugins: ['react'],
18+
rules: {
19+
indent: ['error', 2, { SwitchCase: 1 }],
20+
'linebreak-style': ['error', 'unix'],
21+
quotes: ['error', 'single'],
22+
semi: ['error', 'always'],
23+
'no-console': [
24+
'warn',
25+
{ allow: ['clear', 'info', 'error', 'dir', 'trace'] }
26+
]
27+
}
28+
};

.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
6+
# Runtime data
7+
pids
8+
*.pid
9+
*.seed
10+
11+
# Directory for instrumented libs generated by jscoverage/JSCover
12+
lib-cov
13+
14+
# Coverage directory used by tools like istanbul
15+
coverage
16+
17+
# nyc test coverage
18+
.nyc_output
19+
20+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
21+
.grunt
22+
23+
# node-waf configuration
24+
.lock-wscript
25+
26+
# Compiled binary addons (http://nodejs.org/api/addons.html)
27+
build/Release
28+
29+
# Dependency directories
30+
node_modules
31+
jspm_packages
32+
33+
# Optional npm cache directory
34+
.npm
35+
36+
# Optional REPL history
37+
.node_repl_history

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
## Fullstack JavaScript Development: MongoDB, Node.js, React.js

api/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import express from 'express';
2+
import data from '../src/testData'
3+
4+
// process.on('uncaughtException', function (err) {
5+
// console.log(err);
6+
// });
7+
8+
const router = express.Router();
9+
10+
router.get('/contests', (req, res) => {
11+
res.send({ contests: data.contests });
12+
});
13+
14+
export default router;

babel.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
presets: ['@babel/react', '@babel/env'],
3+
plugins: ['@babel/plugin-proposal-class-properties']
4+
};

config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const env = process.env;
2+
3+
export const nodeEnv = env.NODE_ENV || 'development';
4+
5+
export const logStars = function(msg) {
6+
console.info('***************');
7+
console.info(msg);
8+
console.info('***************');
9+
};
10+
11+
export default {
12+
port: env.PORT || 8080,
13+
host: env.HOST || '0.0.0.0',
14+
get serverUrl() {
15+
return `http://${this.host}:${this.port}`;
16+
}
17+
};

0 commit comments

Comments
 (0)