Just a simple GraphQL server from hero to villain
git clone https://github.com/bahiensed/graphql-server
npm i
npm run dev
mkdir graphql-server
cd graphql-server
npm init -y
npm install --save-dev jest nodemon ts-node-dev typescript
npm update
npm init @eslint/config@latest
npm install @apollo/server @graphql-tools/mock @graphql-tools/schema graphql graphql-tag
{
"name": "graphql-server",
"version": "1.0.0",
"description": "Just a simple GraphQL server from zero to villain",
"main": "./dist/index.js",
"scripts": {
"build": "tsc",
"dev": "ts-node-dev --respawn ./src/index.ts",
"start": "node ./dist/index.js",
"test": "jest"
},
"repository": {
"type": "git",
"url": "git+https://github.com/bahiensed/graphql-server.git"
},
"keywords": [
"Node",
"TypeScript",
"GraphQL",
"Apollo"
],
"author": "Douglas Bahiense @bahiensed",
"license": "ISC",
"bugs": {
"url": "https://github.com/bahiensed/graphql-server/issues"
},
"homepage": "https://github.com/bahiensed/graphql-server#readme",
"devDependencies": {
"@eslint/js": "^9.10.0",
"eslint": "^9.10.0",
"eslint-plugin-react": "^7.36.1",
"globals": "^15.9.0",
"jest": "^29.7.0",
"ts-node-dev": "^2.0.0",
"typescript": "^5.6.2",
"typescript-eslint": "^8.5.0"
},
"dependencies": {
"@apollo/server": "^4.11.0",
"@graphql-tools/mock": "^9.0.4",
"@graphql-tools/schema": "^10.0.6",
"graphql": "^16.9.0",
"graphql-tag": "^2.12.6"
}
}
npx tsc --init
{
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"module": "commonjs",
"target": "es2020",
"moduleResolution": "node",
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules"]
}
ext install GraphQL.vscode-graphql-syntax
https://www.apollographql.com/tutorials/lift-off-part1/04-building-our-schema
npm run dev
npm run build
npm start