Skip to content

Latest commit

 

History

History

api

GraphQL API Server

GraphQL API server implemented using code-first development approach and optimized for hosting in a serverless environment such as Google Cloud Functions or Google Cloud Run.


This project was bootstrapped with GraphQL API Starter Kit. Be sure to join our Discord channel for assistance.

Tech Stack

.
├── auth/                       # Authentication middleware
├── core/                       # Common application modules
├── db/                         # PostgreSQL client and query builder
├── mutations/                  # GraphQL API mutation endpoints
├── queries/                    # Top-level GraphQL API query fields
├── types/                      # GrapHQL API schema types
├── utils/                      # Helper / utility functions
├── views/                      # Handlebar views
├── context.ts                  # GraphQL API context variable(s)
├── env.ts                      # Environment variables validator
├── errors.ts                   # Application errors middleware
├── global.d.ts                 # TypeScript definition overrides
├── graphql.ts                  # GraphQL API schema
├── index.ts                    # Node.js / Express server
├── package.json                # Node.js dependencies
├── rollup.config.js            # Rollup bundler configuration
├── schema.graphql              # GraphQL schema (auto-generated)
└── tsconfig.json               # TypeScript configuration

Requirements

Getting Started

Ensure that the database schema and data is up-to-date by running:

$ yarn db:reset                 # Re-creates the database and applies migrations and seeds

Launch the app in development mode:

$ yarn api:start                # Launch the API server on http://localhost:8080/
$ yarn api:start-debug          # Alternatively, launch it with a debugger (chrome inspector)

Optionally pass the --env=#0 argument with one of the pre-configured environmentsdev (default), local, test, or prod.

The app must become available on http://localhost:8080/api.

How to Test

$ yarn g:lint [--no-cache]      # Lint code with ESLint
$ yarn g:test                   # Run unit tests with Jest
$ yarn tsc                      # Check the code for type errors using TypeScript

How to Debug

Use yarn start-debug instead of yarn start then attach VS Code debugger to the running instance of the app.

How to Deploy

$ yarn api:build
$ yarn api:deploy [--version #0] [--env #0]