Member-only story

GraphQL Server Made Easy with Apollo GraphQL (TypeScript)

From Installing to Creating Posts and Comments using Mutation and Query

Nemesis Blog
4 min readJan 14, 2025

--

For GraphQL Client with Apollo and NextJS you can check on this story

For Video version check this

Prerequisite

  1. Apollo GraphQL Server

Setup GraphQL Server (Typescript)

  • Create new folder graphql-server
mkdir graphql-server
cd graphql-server
  • Initialize new node.js project
npm init --yes && npm pkg set type="module"
  • Install Apollo Server
npm install @apollo/server graphql
  • Run this command to setup typescript
mkdir src
touch src/index.ts
npm install --save-dev typescript @types/node
touch tsconfig.json
  • copy this config below to your tsconfig.json
{
"compilerOptions": {
"rootDirs": ["src"],
"outDir": "dist",
"lib": ["es2020"],
"target": "es2020",
"module": "esnext",
"moduleResolution": "node",
"esModuleInterop": true,
"types": ["node"]
}
}
  • update script package.json like this and make sure…

--

--

No responses yet