Skip to content

Commit 15d3a41

Browse files
committed
initial code for tutorial-1, added .next to .gitignore
1 parent 691e91c commit 15d3a41

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1981
-18
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ npm-debug.log
1111
node_modules/
1212
.coverage
1313
.env
14-
env-config.js
14+
.next
1515

1616
book/8-exp

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
book
22
boilerplate
3+
tutorials
34

45
test
56
.coverage

boilerplate/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ npm-debug.log
1010
.vscode/
1111
node_modules/
1212
.coverage
13-
.env
13+
.env
14+
.next

boilerplate/pages/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Index extends React.Component {
2424
<title>Dashboard</title>
2525
<meta
2626
name="description"
27-
content="List of purchased books."
27+
content="description for indexing bots"
2828
/>
2929
</Head>
3030
<p> Dashboard </p>

book/1-end/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ npm-debug.log
1010
.vscode/
1111
node_modules/
1212
.coverage
13-
.env
13+
.env
14+
.next

book/1-start/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ npm-debug.log
1010
.vscode/
1111
node_modules/
1212
.coverage
13-
.env
13+
.env
14+
.next

book/2-end/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ npm-debug.log
1010
.vscode/
1111
node_modules/
1212
.coverage
13-
.env
13+
.env
14+
.next

book/3-end/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ npm-debug.log
1010
.vscode/
1111
node_modules/
1212
.coverage
13-
.env
13+
.env
14+
.next

book/3-start/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ npm-debug.log
1010
.vscode/
1111
node_modules/
1212
.coverage
13-
.env
13+
.env
14+
.next

book/4-end/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ npm-debug.log
1010
.vscode/
1111
node_modules/
1212
.coverage
13-
.env
13+
.env
14+
.next

book/4-start/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ npm-debug.log
1010
.vscode/
1111
node_modules/
1212
.coverage
13-
.env
13+
.env
14+
.next

book/5-end/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ npm-debug.log
1010
.vscode/
1111
node_modules/
1212
.coverage
13-
.env
13+
.env
14+
.next

book/5-start/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ npm-debug.log
1010
.vscode/
1111
node_modules/
1212
.coverage
13-
.env
13+
.env
14+
.next

book/6-end/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ npm-debug.log
1010
.vscode/
1111
node_modules/
1212
.coverage
13-
.env
13+
.env
14+
.next

book/6-start/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ npm-debug.log
1010
.vscode/
1111
node_modules/
1212
.coverage
13-
.env
13+
.env
14+
.next

book/7-end/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ npm-debug.log
1010
.vscode/
1111
node_modules/
1212
.coverage
13-
.env
13+
.env
14+
.next

book/7-start/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ npm-debug.log
1010
.vscode/
1111
node_modules/
1212
.coverage
13-
.env
13+
.env
14+
.next

book/8-end/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ npm-debug.log
1010
.vscode/
1111
node_modules/
1212
.coverage
13-
.env
13+
.env
14+
.next

book/8-end/env-config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const dev = process.env.NODE_ENV !== 'production';
2+
3+
module.exports = {
4+
StripePublishableKey: dev
5+
? process.env.Stripe_Test_PublishableKey
6+
: process.env.Stripe_Live_PublishableKey,
7+
};

book/8-start/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ npm-debug.log
1010
.vscode/
1111
node_modules/
1212
.coverage
13-
.env
13+
.env
14+
.next

env-config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const dev = process.env.NODE_ENV !== 'production';
2+
3+
module.exports = {
4+
StripePublishableKey: dev
5+
? process.env.Stripe_Test_PublishableKey
6+
: process.env.Stripe_Live_PublishableKey,
7+
};

tutorials/tutorial-1-end/.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["env", "next/babel"]
3+
}

tutorials/tutorial-1-end/.eslintrc.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
module.exports = {
2+
parser: 'babel-eslint',
3+
extends: 'airbnb',
4+
env: {
5+
browser: true,
6+
jest: true,
7+
},
8+
plugins: ['react', 'jsx-a11y', 'import'],
9+
rules: {
10+
'max-len': ['error', 100],
11+
'no-underscore-dangle': ['error', { allow: ['_id'] }],
12+
'prefer-destructuring': [
13+
'error',
14+
{
15+
VariableDeclarator: {
16+
array: false,
17+
object: true,
18+
},
19+
AssignmentExpression: {
20+
array: true,
21+
object: false,
22+
},
23+
},
24+
{
25+
enforceForRenamedProperties: false,
26+
},
27+
],
28+
'import/prefer-default-export': 'off',
29+
'jsx-a11y/anchor-is-valid': 'off',
30+
'react/react-in-jsx-scope': 'off',
31+
'react/jsx-filename-extension': [
32+
'error',
33+
{
34+
extensions: ['.js'],
35+
},
36+
],
37+
},
38+
};

tutorials/tutorial-1-end/.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
*~
2+
*.swp
3+
tmp/
4+
npm-debug.log
5+
.DS_Store
6+
7+
8+
.build/*
9+
.next
10+
.vscode/
11+
node_modules/
12+
.coverage
13+
.env
14+
.next

tutorials/tutorial-1-end/README.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
## Boilerplate
2+
Boilerplate with React, Material-UI, Next, Express, Mongoose, MongoDB.
3+
4+
5+
## Contents
6+
- [Run locally](#run-locally)
7+
- [Deploy](#deploy)
8+
- [Built with](#built-with)
9+
- [Core stack](#core-stack)
10+
- [Third party APIs](#third-party-apis)
11+
- [Project structure](#project-structure)
12+
13+
14+
## Run locally
15+
- Clone the project and run `yarn` to add packages.
16+
- Before you start the app, create a `.env` file at the app's root. This file must have _at least three env variables_: `MONGO_URL_TEST`, `Google_clientID`, `Google_clientSecret`. We recommend [free MongoDB at mLab](http://docs.mlab.com/).
17+
18+
`.env` :
19+
```
20+
MONGO_URL_TEST="XXXXXX"
21+
22+
Google_clientID="XXXXXX"
23+
Google_clientSecret="XXXXXX"
24+
```
25+
26+
For Google OAuth app, callback URL is: http://localhost:8000/oauth2callback
27+
You have to enable Google+ API in your Google Cloud Platform account.
28+
29+
- Start the app with `yarn dev`.
30+
31+
- The _first registered user_ in the app becomes an Admin user (`"isAdmin": true`).
32+
33+
34+
## Deploy
35+
See the [deploy section](https://github.com/builderbook/builderbook#deploy) on our main repository README.
36+
37+
38+
## Built with
39+
40+
#### Core stack
41+
- [React](https://github.com/facebook/react)
42+
- [Material-UI](https://github.com/mui-org/material-ui)
43+
- [Next](https://github.com/zeit/next.js)
44+
- [Express](https://github.com/expressjs/express)
45+
- [Mongoose](https://github.com/Automattic/mongoose)
46+
- [MongoDB](https://github.com/mongodb/mongo)
47+
48+
#### Third party APIs
49+
- Google OAuth
50+
51+
Check out [package.json](https://github.com/builderbook/builderbook/blob/master/boilerplate/package.json).
52+
53+
54+
## Project structure
55+
56+
```
57+
.
58+
├── components # React components
59+
│ ├── Header.js # Header component
60+
│ ├── MenuDrop.js # Dropdown menu
61+
│ ├── SharedStyles.js # List of _reusable_ styles
62+
├── lib # Code available on both client and server
63+
│ ├── context.js # Context for Material-UI integration
64+
│ ├── withAuth.js # HOC that passes user to pages and more
65+
│ ├── withLayout.js # HOC for SSR with Material-UI and more
66+
├── pages # Pages
67+
│ ├── login.js # Login page
68+
│ ├── _document.js # Allows to customize pages (feature of Next.js)
69+
│ ├── index.js # Homepage
70+
├── server # Server code
71+
│ ├── models # Mongoose models
72+
│ │ ├── User.js # User model
73+
│ ├── app.js # Custom Express/Next server
74+
│ ├── google.js # Google OAuth API
75+
├── static # Static resources
76+
├── .babelrc # Config for Babel
77+
├── .eslintrc.js # Config for Eslint
78+
├── .gitignore # List of ignored files and directories
79+
├── package.json # List of packages and scripts
80+
├── yarn.lock # Exact versions of packages. Generated by yarn.
81+
82+
```

0 commit comments

Comments
 (0)