- 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
- schema.js
- test
- test.js
test runner, include all tests here
- test.js
- 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
- functions.js
- Try running sample code (instructions below)
- Remember to change the schema back to project schema (revert step 2 of
How to run sample code
) - Identify the queries and mutations that you will need to complete at util/schema.js
- Replace the source code under src according to your requirements
- Update binding.js according to your query and mutation functions
- After cloning the project
- Edit file util/app.js
- Comment line 15
const schema = require('./schema');
- Uncomment line 17
const schema = require('./schema.sample');
- Comment line 15
- Run server by instructions in
How to run local server
- Run test cases by instructions in
How to run test cases
- Setup environment variables
MONGODB_USERNAME
mongodb usernameMONGODB_PASSWORD
mongodb passwordMONGODB_HOST
mongodb host / IPMONGODB_DB
mongodb database nameMONGODB_OPTION
mongodb connection option, e.g. authSource=admin
- Run app.js
- Open terminal
- cd to project folder
- Execute
mocha