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

.
├── core/                       # Common application modules
├── 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
├── global.d.ts                 # TypeScript definition overrides
├── graphql.ts                  # GraphQL API schema
├── index.ts                    # Node.js / Express server
├── package.json                # Node.js dependencies
├── schema.graphql              # GraphQL schema (auto-generated)
├── schema.ts                   # GraphQL schema (code-first)
├── tsconfig.json               # TypeScript configuration
└── vite.config.ts              # Bundler 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]