Welcome to the Godspeed GraphQL Plugin! 🚀
Godspeed leverages Apollo Server, a powerful and extensible open-source server built on GraphQL, to streamline the creation of GraphQL APIs. Apollo Server excels in automatic schema generation and seamless integration with diverse data sources, providing a robust foundation for scalable and high-performance GraphQL applications.
This guide offers a concise overview of integrating the GraphQL plugin into the Godspeed framework as an Event Source.
-
Add the GraphQL plugin to Godspeed-CLI with the
godspeed plugin add
command. -
Tailor the configuration file according to your needs in
eventsource/graphql.yaml
.
- Create a godspeed project from the CLI , open the created project in vscode and then add the plugin from the CLI of vscode, select the
@godspeedsystems/plugins-graphql-as-eventsource
to integrate the plugin.
> godspeed plugin add
,_, ╔════════════════════════════════════╗
(o,o) ║ Welcome to Godspeed ║
({___}) ║ World's First Meta Framework ║
" " ╚════════════════════════════════════╝
? Please select godspeed plugin to install: (Press <space> to select, <Up and Down> to move rows)
┌────┬───────────────────────────────────┬─────────────────────────────────────────────────────────────────┐
│ │ Name │ Description │
├────┼───────────────────────────────────┼─────────────────────────────────────────────────────────────────┤
│ ❯◯ │ graphql-as-eventsource │ graphql as eventsource plugin for Godspeed Framework │
├────┼───────────────────────────────────┼─────────────────────────────────────────────────────────────────┤
│ ◯ │ aws-as-datasource │ aws as datasource plugin for Godspeed Framework │
├────┼───────────────────────────────────┼─────────────────────────────────────────────────────────────────┤
│ ◯ │ mailer-as-datasource │ mailer as datasource plugin for Godspeed Framework │
├────┼───────────────────────────────────┼─────────────────────────────────────────────────────────────────┤
│ ◯ │ excel-as-datasource │ excel as datasource plugin for Godspeed Framework │
├────┼───────────────────────────────────┼─────────────────────────────────────────────────────────────────┤
│ ◯ │ kafka-as-datasource-as-eventsource│ kafka as datasource-as-eventsource plugin for Godspeed Framework│
└────┴───────────────────────────────────┴─────────────────────────────────────────────────────────────────┘
type: graphql
port: 4000
- Ensure the event key prefix aligns with the name of the configuration YAML file. In this example, the prefix for the Event key is
Apollo
. The event schema follows REST standards, resembling HTTP events.
graphql.post./mongo/category:
summary: Create a new Category
description: Create Category from the database
fn: create
body:
content:
application/json:
schema:
type: object
properties:
name:
type: string
responses:
content:
application/json:
schema:
type: object
summary: Create Category
tasks:
- id: mongo_category_create
fn: datasource.mongo.Category.create
args:
data: <% inputs.body %>
-
use
godspeed gen-graphql-schema
to auto generate graphql schema. -
use
godspeed serve
to start server.
This configuration emphasizes the simplicity of implementing GraphQL within the Godspeed framework, promoting efficiency and clarity in API development.
Happy coding with Godspeed...🚀