GraphQL API endpoint as a standalone (micro)service, backing up web front-ends and/or mobile apps requests. It will be used for internal purposes and in future for external clients to share oor services.
- Docker, Node.js, Yarn, TypeScript — core platform and dev tools
- Express, cors etc. — common HTTP-server features
- GraphQL.js, DataLoader, validator — GraphQL schema and API endpoint
.
├── /dist/ # The compiled output (via TypeScript)
├── /src/ # Node.js application source files
│ ├── /schema/ # GraphQL schema type definitions
│ ├── /server.ts # Node.js server (entry point)
├── /types/ # TypeScript type definitions
├── package.json # List of project dependencies- VS Code editor (preferred) + Project Snippets, EditorConfig, TSLint, Typescript. plug-ins.
Just clone the repo and run docker-compose up:
git clone https://github.com/khdevnet/warehouse-graphql
cd example-api # Change current directory to the newly created one
docker-compose up # Launch Docker containers with the Node.js API app running insideThe API server must become available at http://localhost:8080/graphql.
Once the Docker container named api is started, the Docker engine executes node tools/run.js
command that installs Node.js dependencies, migrates database schema to the latest version,
compiles Node.js app from source files (see src) and launches it with "live reload"
on port 8080.
yarn lint # Find problematic patterns in code
yarn check # Check source code for type errors
yarn docker-test # Run unit tests once inside a Docker container
yarn docker-test-watch # Run unit tests in watch mode inside a Docker containerFor more information visit http://facebook.github.io/jest/
In order to run the app with V8 inspector enabled, simply replace node tools/run.js
with node --inspect=0.0.0.0:9229 tools/run.js in either docker-compose.yml
file or, even better, in docker-compose.override.yml. Then restart the app (docker-compose up) and
attach your debugger to 127.0.0.1:9230 (see .vscode/launch.json)
- GraphQL.js — The JavaScript reference implementation for GraphQL
- DataLoader — Batching and caching for GraphQL data access layer
- Membership Database — SQL schema boilerplate for user accounts, profiles, roles, and auth claims