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

[RFC] opinionated changes #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion db.json

This file was deleted.

13 changes: 0 additions & 13 deletions package-lock.json

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"hexo": {
"version": "3.6.0"
"version": "3.7.1"
},
"dependencies": {
"canonical-json": "0.0.4",
Expand Down Expand Up @@ -31,4 +31,4 @@
"deploy": "hexo-s3-deploy",
"start": "hexo server"
}
}
}
2 changes: 1 addition & 1 deletion source/recipes/queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ And inside your resolver:
}
```

Now if you go to your [GraphQL Playground](http://localhost:3000/graphql) you can run this:
Now if you go to http://localhost:3000/graphql you can run this:

```
query {
Expand Down
2 changes: 1 addition & 1 deletion source/starterpack/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ disqusPage: 'Starterpack:Deployment'

## PM2 Meteor

You can setup your server on AWS or DigitalOcean. We recommend you use `Ubuntu 16.04` to quickly deploy without hassles.
You can setup your server on [AWS](https://aws.amazon.com) or [DigitalOcean](https://www.digitalocean.com/). We recommend you use `Ubuntu 16.04` to quickly deploy without hassles.

We have the ability to quickly deploy our apps. One of the easiest way to do it, is to use `pm2-meteor`:

Expand Down
2 changes: 1 addition & 1 deletion source/starterpack/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default {
};
```

Pretty straight forward right ? The reason we do it like this, by centralizing security in one place,
Pretty straight forward right? The reason we do it like this, by centralizing security in one place,
is to remove boilerplate code inside our methods and keep separation of concerns. You can do it however you want it, there is no right or wrong way to do it,
depends on your use-case, but we believe that it is easier to maintain, and newly onboarded developers were writing secure
code right from the start!
Expand Down
15 changes: 8 additions & 7 deletions source/starterpack/setting-up.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ meteor npm i -S react-apollo apollo-live-client apollo-client apollo-cache-inmem
# If you're looking into Server Side Rendering with React
meteor npm i -S react-dom react-router apollo-link-schema

# Now we add the package
# Now we add the package for a plug and play zero-config graphql server with meteor and other helpful features
meteor add cultofcoders:apollo

# Optional but highly recommended (so you can import .gql/.graphql files)
Expand All @@ -45,11 +45,11 @@ Add the following to `package.json`, it will allow us to specify the entry point
```

```
mkdir -p src/startup/client src/startup/server src/api
touch src/startup/client/index.js src/startup/server/index.js src/api/index.js
mkdir -p src/startup/client src/startup/server src/api tests
touch src/startup/client/index.js src/startup/server/index.js src/api/index.js tests/main.js
```

Now go to `src/startup/server/index.js` and add this:
Now go to `src/startup/server/apollo.js` and add this in order to initialize GraphQL:

```js
// src/startup/server/apollo.js
Expand Down Expand Up @@ -79,6 +79,7 @@ load({
```

```js
// src/startup/server/index.js
import '../../api';
import './apollo';
```
Expand All @@ -101,11 +102,11 @@ query {

## Module Aliases

In addition to what we just described, you can also create module aliases so:
In addition to what we just described, you can also create module aliases so run the following command:

`npm i --save-dev babel-plugin-module-resolver`
`meteor npm i --save-dev babel-plugin-module-resolver`

In `.babelrc`
Create a file `.babelrc` in the root folder

```
{
Expand Down
14 changes: 7 additions & 7 deletions source/starterpack/structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ We will introduce to following folders:
Our GraphQL schema will exist in: `src/api` and it is composed of `entities` and `modules`. An entity is a type, but since type is such a generic word in JS world, we are going to refer to them as entities.

```gql
# entities/User.gql
# src/api/entities/User.gql
type User {
_id: ID!
firstName: String
Expand All @@ -33,7 +33,7 @@ type User {
```

```js
// entites/User.resolvers.js
// src/api/entites/User.resolvers.js
export default {
User: {
fullName: user => `${user.firstName} ${user.lastName}`,
Expand All @@ -44,7 +44,7 @@ export default {
And the place where we aggregate them all:

```js
// entities/index.js
// src/api/entities/index.js

import UserType from './User.gql';
import UserResolvers from './User.resolvers.js';
Expand All @@ -61,7 +61,7 @@ export default {

We regard as a GraphQL module an object that contains typeDefs and/or resolvers. Using the `graphql-load` package this allows us to work with these modules and allows us to think about them logically separated.

In our case inside `entities/index.js` what we export is a GraphQL Module.
In our case inside `src/api/entities/index.js` what we export is a GraphQL Module.

So to aggregate and use that, we'll create our entry point for loading inside:

Expand All @@ -79,7 +79,7 @@ load([EntitiesModule, UserModule, PostModule]);
A sample implementation of the `post` module inside `src/api/modules/post`:

```
# ./typeDefs.gql
# src/api/modules/post/typeDefs.gql
type Query {
posts: [Post]
}
Expand All @@ -90,7 +90,7 @@ type Mutation {
```

```js
// ./resolvers.js
// src/api/modules/post/resolvers.js
export default {
Query: {
posts: () => {
Expand Down Expand Up @@ -235,7 +235,7 @@ Posts.attachSchema(PostSchema);
```

```js
// src/db/posts/index.js
// src/db/index.js
import Posts from './posts/collection';

export { Posts };
Expand Down