 and info are not necessary in these resolvers, only parent and args are defined.

Save and exit the file once you’re done.

Note: When a resolver returns the same field as the resolver’s name, like the four resolvers for Post, Apollo Server will automatically resolve those. This means you don’t have to explicitly define those resolvers.

-  Post: {
-    content: (parent) => parent.content,
-    id: (parent) => parent.id,
-    published: (parent) => parent.published,
-    title: (parent) => parent.title,
-  },
 
Finally, you export the schema and resolvers so that you can use them in the next step to instantiate the server with Apollo Server.

## Step 3 — Creating the GraphQL Server
In this step, you will create the GraphQL server with Apollo Server and bind it to a port so that the server can accept connections.

First, run the following command to create the file for the server:

```java
nano src/server.js
```
 
Now add the following code to the file:

prisma-graphql/src/server.js
```java
const { ApolloServer } = require('apollo-server')
const { resolvers, typeDefs } = require('./schema')

const port = process.env.PORT || 8080

new ApolloServer({ resolvers, typeDefs }).listen({ port }, () =>
  console.log(`Server ready at: http://localhost:${port}`),
)
```
 
Here you instantiate the server and pass the schema and resolvers from the previous step.

The port the server will bind to is set from the PORT environment variable and if not set, it will default to 8080. The PORT environment variable will be automatically set by App Platform and ensure your server can accept connections once deployed.

Save and exit the file.

Your GraphQL API is ready to run. Start the server with the following command:

```java
node src/server.js
```
 
You will receive the following output:

Output
```java
Server ready at: http://localhost:8080
```

It’s considered good practice to add a start script to your package.json so that the entry point to your server is clear. Moreover, this will allow App Platform to start the server once deployed.

To do so, add the following line to the "scripts" object in package.json:

package.json
```java
{
  "name": "prisma-graphql",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node./src/server.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "apollo-server": "^2.18.2",
    "graphql": "^15.3.0"
  }
}
```
 
Save and exit the file once you’re finished.

Now you can start the server with the following command:

```java
npm start
```
 
To test the GraphQL API, open the URL from the output, which will lead you to the GraphQL Playground.

![GraphQL Playground](https://github.com/coding-to-music/prisma-graphql/blob/main/images/step3a.png?raw=true)

The GraphQL Playground is an IDE where you can test the API by sending queries and mutations.

For example, to test the feed query which only returns published posts, enter the following query to the left side of the IDE and send the query by pressing the play button:

```java
query {
  feed {
    id
    title
    content
    published
  }
}
```
 
The response will show a title of Subscribe to GraphQL Weekly with its URL and Follow DigitalOcean on Twitter with its URL.

![GraphQL query](https://github.com/coding-to-music/prisma-graphql/blob/main/images/step3b.png?raw=true)

To test the createDraft mutation, enter the following mutation:

```java
mutation {
  createDraft(title: "Deploying a GraphQL API to DigitalOcean") {
    id
    title
    content
    published
  }
}
```
 
After you submit the mutation, using the play button, you will receive Deploying a GraphQL API to DigitalOcean within the title field as part of the response.

![GraphQL mutation](https://github.com/coding-to-music/prisma-graphql/blob/main/images/step3c.png?raw=true)

Note: You can choose which fields to return from the mutation by adding or removing fields within the curly braces following createDraft. For example, if you wanted to only return the id and title you could send the following mutation:

```java
mutation {
  createDraft(title: "Deploying a GraphQL API to DigitalOcean") {
    id
    title
  }
}
```
 
You have successfully created and tested the GraphQL server. In the next step, you will create a GitHub repository for the project.

## Step 4 — Creating the GitHub Repository
In this step, you will create a GitHub repository for your project and push your changes so that the GraphQL API can be automatically deployed from GitHub to App Platform.

Begin by initializing a repository from the prisma-graphql folder:

```java
git init
```
 
Next, use the following two commands to commit the code to the repository:

```java
git add src package-lock.json package.json
git commit -m 'Initial commit'
```
 
Now that the changes have been committed to your local repository, you will create a repository in GitHub and push your changes.

Go to GitHub to create a new repository. For consistency, name the repository prisma-graphql and then click Create repository.

After the repository was created, push the changes with the following commands, which includes renaming the default local branch to main:

```java
git remote add origin <EMAIL>:your_github_username/prisma-graphql.git
git branch -M main
git push --set-upstream origin main
```
 
You have successfully committed and pushed the changes to GitHub. Next, you will connect the repository to App Platform and deploy the GraphQL API.

## Step 5 — Deploying to App Platform
In this step, you will connect the GitHub repository you created in the previous step to DigitalOcean and configure App Platform so that the GraphQL API can be automatically deployed when you push changes to GitHub.

First, go to the [App Platform](https://cloud.digitalocean.com/apps) and click on the Launch Your App button.

You will see a button to link your GitHub account.

![Link Your GitHub Acccount](https://github.com/coding-to-music/prisma-graphql/blob/main/images/step5a.png?raw=true)

Click on it, and you will be redirected to GitHub.

Click Install & Authorize and you will be redirected back to DigitalOcean.

Choose the repository your_github_username/prisma-graphql and click Next.

![Name your app and pick a branch to deploy from](https://github.com/coding-to-music/prisma-graphql/blob/main/images/step5d.png?raw=true)


Choose the region you want to deploy your app to and click Next.

![Configure your app](https://github.com/coding-to-music/prisma-graphql/blob/main/images/step5e.png?raw=true)

Here you can customize the configuration for the app. Ensure that the Run Command is npm start. By default, App Platform will set the HTTP port to 8080, which is the same port that you’ve configured your GraphQL server to bind to.

Click Next and you will be prompted to pick the plan.

Select Basic and then click Launch Basic App. You will be redirected to the app page, where you will see the progress of the initial deployment.

Once the build finishes, you will get a notification indicating that your app is deployed.

![App page](https://github.com/coding-to-music/prisma-graphql/blob/main/images/step5f.png?raw=true)

You can now visit your deployed GraphQL API at the URL below the app’s name. It will be under the ondigitalocean.app subdomain. If you open the URL, the GraphQL Playground will open the same way as it did in Step 3 of the tutorial.

You have successfully connected your repository to App Platform and deployed your GraphQL API. Next you will evolve your app and replace the