Skip to content
This repository has been archived by the owner on Dec 2, 2017. It is now read-only.

Folder Structure

Sergio Xalambrí edited this page Jul 26, 2017 · 3 revisions

Grial is a framework with a little convention over configuration paradigm. You can basically do whatever you want inside your project directory but Grial ask you to follow a basic file convention.

Aside of the below files you can create any other files, you can even split your API and application code in many little files and let this required files import them and use them internally.

Required files

./connectors.js (optional)

Data source connectors, they can be your own custom connectors or you can just re-export the Grial connectors you download from npm.

./loaders.js (optional)

Data loaders you can use to batch requests or queries. They are recreated per request and because of that have a single request cache. Receive the models and connectors and can use them internally to fetch data.

./models.js (optional)

Your application models, they can use a single connector or even use multiple ones. Here's where your application business logic must reside.

/resolvers.js (required)

Your API schema resolvers. The resolvers receive the connectors, loaders and models from context and allow you to use them as you want. They are intented to be as dummy as possible and you must keep your logic inside your models.

./schema.gql or ./schema.graphql (required)

Your API schema definition. It's just a .gql file with all your API schema.