diff --git a/quickstart-with-apollo/README.md b/quickstart-with-apollo/README.md index dd4f04e..c510139 100755 --- a/quickstart-with-apollo/README.md +++ b/quickstart-with-apollo/README.md @@ -21,23 +21,54 @@ cd angular-graphql/quickstart-with-apollo ### 2. Create GraphQL API with [`graphcool`](https://www.npmjs.com/package/graphcool) +#### 2.1. Create Graphcool project + ```sh # Install Graphcool CLI npm install -g graphcool -# Create a new project based on the Instagram schema -graphcool init --schema https://graphqlbin.com/instagram.graphql +# Create a new "blank" project inside a directory called "graphcool" +graphcool init graphcool --template blank +``` + +This creates a new project inside your Graphcool account as well as the local project structure inside the `graphcool` directory: + ``` +. +└── graphcool + ├── code + │ ├── hello.graphql + │ └── hello.js + ├── graphcool.yml + └── types.graphql + +``` + +Read the documentation to learn more about the file structure and [project configuration](https://www.graph.cool/docs/reference/basics/project-configuration-t%28yaml%29-opheidaix3). -This creates a GraphQL API for the following schema: +#### 2.2. Configure data model + +Open `./graphcool/types.graphql` and add the following type definition to it: ```graphql type Post { + id: ID! @isUnique + createdAt: DateTime! + updatedAt: DateTime! description: String! imageUrl: String! } ``` +Now apply the changes you just made locally to the remote project in your Graphcool account: + +```sh +cd graphcool +graphcool deploy +``` + +The `Post` type is now added to your data model and the corresponding CRUD operations are generated. + ### 3. Connect the app with your GraphQL API Copy the `Simple API` endpoint to `./src/app/client.ts` as the `uri` argument in the `createNetworkInterface` call: @@ -59,6 +90,7 @@ yarn start # open http://localhost:3000 in your browser * [Advanced GraphQL features](https://www.graph.cool/docs/tutorials/advanced-features-eath7duf7d/) * [Authentication & Permissions](https://www.graph.cool/docs/reference/authorization/overview-iegoo0heez/) * [Implementing business logic with serverless functions](https://www.graph.cool/docs/reference/functions/overview-boo6uteemo/) +* [Dive deeper into GraphQL on How to GraphQL](https://www.howtographql.com) ## Help & Community [](https://slack.graph.cool)