API module for OctoberCMS
- Copy module to {project root}/modules/api
- Run command
composer update
in project root - Add
api
tocms.loadModules
configuration - Run command
php artisan vendor:publish --provider="Api\ServiceProvider"
in project root
You can use the schema located at {project root}/graphql/schema.graphql.
- Add the following function to your Plugin.php file.
public function registerGraphQLModels()
{
return [
'RainLab\User\Models\User',
];
}
- Create /plugins/user/models/user/schema.graphql
Schemas created for a model inside of a plugin should always use
extend type Query
to define a query.
The modules comes with the GraphQL playground. Go to /graphql-playground in your browser and test your schema here.