8000 GitHub - KaranBrains/graph-ql
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

KaranBrains/graph-ql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jciep

Graphql Schema

schema.js

Project Structure

  • app.js runner class for your testing, you may add your express middleware for debug here
  • binding.js bind your query and mutation functions here
  • util
    • schema.js graphql schema of this project
    • schema.sample.js graphql schema of the sample code that comes along with this project initially
    • app.js init express
    • mongo.js connect mongo using mongoose
    • permission.js project-based permission checking methods for queries and mutations
    • test.js testing functions, including graphql request methods with credentials
  • test
    • test.js test runner, include all tests here
  • src put all your source code here, you may feel free to add more classes here
    • functions.js sample query and mutation functions with permission checking
    • model.js sample model with create, update and delete logics
    • test.js sample test cases

What you should do

  1. Try running sample code (instructions below)
  2. Remember to change the schema back to project schema (revert step 2 of How to run sample code)
  3. Identify the queries and mutations that you will need to complete at util/schema.js
  4. Replace the source code under src according to your requirements
  5. Update binding.js according to your query and mutation functions

How to run sample code

  1. After cloning the project
  2. Edit file util/app.js
    1. Comment line 15 const schema = require('./schema');
    2. Uncomment line 17 const schema = require('./schema.sample');
  3. Run server by instructions in How to run local server
  4. Run test cases by instructions in How to run test cases

How to run local server

  1. Setup environment variables
    1. MONGODB_USERNAME mongodb username
    2. MONGODB_PASSWORD mongodb password
    3. MONGODB_HOST mongodb host / IP
    4. MONGODB_DB mongodb database name
    5. MONGODB_OPTION mongodb connection option, e.g. authSource=admin
  2. Run app.js

How to run test cases

  1. Open terminal
  2. cd to project folder
  3. Execute mocha

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0