Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

skava / @skava/graphql   js

Repository URL to install this package:

Version: 9.0.35-framework 

/ README.md

uxui-graphql

🚀 GraphQL server

Getting started

(prerequesite - you have node & yarn & xcode/make - mac || make - windows installed)

# 1. Navigate to the folder
# 2. Run yarn install
# 3. Start server using yarn run start  (runs on http://localhost:4000) and open in GraphQL Playground

alt text alt text

Documentation

Commands

  • make dev starts GraphQL server on http://localhost:4000
  • make mock_dev same as make dev, but with mocks
  • make build builds the project (for use in deployment)
  • make build_prod builds the production version of the project (does not include index.js)
  • make tests run the unit tests (runs 1x)
  • make tdd run test-driven-development mode (it will watch the tests for changes and re-run them)
  • make build_schema builds the schema (important to run this, until it's done automatically)
  • make build_fragments generates fragments for all models
  • make build_types generates ts types for all models

Env

  • LOG_LEVEL_STREAM_PROXY=debug for logging proxy requests
  • IS_STANDALONE_GRAPHQL=boolean for running the app on its own
  • LOG_REQUEST_PARAMS=true log all request params
  • LOG_REQUEST_RESPONSE=true log all responses
  • LOG_REQUEST_ERROR=true log all errors in requests
  • API_PORT=4000 port to run the app on, if it's standalone (also compat with skreact)
  • API_URL=http://localhost:4000 the absolute url to run the server requests with
  • CORS=http://1,http://2 cross-origin urls to accept

Project structure

File name                Description         
└── src (directory) Contains the source files for the GraphQL server
  ├── index.js The entry point for the GraphQL server

Features

  • SkavaGraphQL server: The server uses graphql-yoga which is based on Apollo Server & Express

Next


Snippets

proxy

http://localhost:4000/api/productlist/plainteesmen?campaignId=2691&offset=0&limit=100&locale=en_US&storeid=atlanta

mock

  • set your ENV values (cross-env for windows, or just ENV_NAME=value for mac)
  • running this repo standalone requires only a change to start.js

graphiql

  • graphql-playground (available at /playground)
  • graphiql (available at /graphiql)
  • http://localhost:4000/graphiql?query=%7B%0A%20%20productList(categoryId%3A%20%22plainteesmen%22%20limit%3A%2012%20offset%3A%200)%20%7B%0A%20%20%20%09products%20%7B%0A%20%20%20%20%09name%0A%20%20%09%7D%0A%20%20%7D%0A%7D