Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert command server to GraphQL endpoint #143

Closed
cowboyd opened this issue Dec 5, 2019 · 1 comment
Closed

Convert command server to GraphQL endpoint #143

cowboyd opened this issue Dec 5, 2019 · 1 comment

Comments

@cowboyd
Copy link
Member

cowboyd commented Dec 5, 2019

Rather than implement our own command interpreter we'll get one for free using GraphQL. This will allow us to not only get a command a query language (and response payload) with little effort, but we'll be able to use all of the tooling surrounding the GraphQL ecosystem (like the interactive webshell)

Right now, the command server doesn't do anything except echo the text "Your wish is my command" to any response. Instead, it should be a full GraphQL endpoint. The GraphQL endpoint should only handle responses of type application/json so that later we can serve the web UI over text/html

The goal here is to get the GraphQL interpreter in place, not to actually do anything with it yet, so we'll define and implement minimal schema that just contains an echo query that can be used to verify that the http mechanics are up and running:

type Query {
  echo(text: string!): string;
}

thus
query: { echo(text: "hello world") }
response: { "echo": "hello world" }

cowboyd referenced this issue in bigtestjs/server Dec 6, 2019
From https://github.com/bigtestjs/server/issues/29

> Rather than implement our own command interpreter we'll get one for
> free using GraphQL. This will allow us to not only get a command a
> query language (and response payload) with little effort, but we'll
> be able to use all of the tooling surrounding the GraphQL
> ecosystem (like the interactive webshell)

This uses the `graphql-express` packgage [recommended by
graphql.org][1] to implement a graphql endpoint that satisfies our
requrements. It serves graphql over simple `GET` and `POST` requests
that accept `application/json`, but if the request is for `html`, then
it will server the `GraphiQL` IDE.

[1]: https://graphql.org/learn/serving-over-http/#node
cowboyd referenced this issue in bigtestjs/server Dec 6, 2019
From https://github.com/bigtestjs/server/issues/29

> Rather than implement our own command interpreter we'll get one for
> free using GraphQL. This will allow us to not only get a command a
> query language (and response payload) with little effort, but we'll
> be able to use all of the tooling surrounding the GraphQL
> ecosystem (like the interactive webshell)

This uses the `graphql-express` packgage [recommended by
graphql.org][1] to implement a graphql endpoint that satisfies our
requrements. It serves graphql over simple `GET` and `POST` requests
that accept `application/json`, but if the request is for `html`, then
it will server the `GraphiQL` IDE.

Since the raw http server is not used anymore, the code dedicated to
it has been removed.

[1]: https://graphql.org/learn/serving-over-http/#node
cowboyd referenced this issue in bigtestjs/server Dec 6, 2019
From https://github.com/bigtestjs/server/issues/29

> Rather than implement our own command interpreter we'll get one for
> free using GraphQL. This will allow us to not only get a command a
> query language (and response payload) with little effort, but we'll
> be able to use all of the tooling surrounding the GraphQL
> ecosystem (like the interactive webshell)

This uses the `graphql-express` packgage [recommended by
graphql.org][1] to implement a graphql endpoint that satisfies our
requrements. It serves graphql over simple `GET` and `POST` requests
that accept `application/json`, but if the request is for `html`, then
it will server the `GraphiQL` IDE.

Since the raw http server is not used anymore, the code dedicated to
it has been removed.

[1]: https://graphql.org/learn/serving-over-http/#node
cowboyd referenced this issue in bigtestjs/server Dec 6, 2019
From https://github.com/bigtestjs/server/issues/29

> Rather than implement our own command interpreter we'll get one for
> free using GraphQL. This will allow us to not only get a command a
> query language (and response payload) with little effort, but we'll
> be able to use all of the tooling surrounding the GraphQL
> ecosystem (like the interactive webshell)

This uses the `graphql-express` packgage [recommended by
graphql.org][1] to implement a graphql endpoint that satisfies our
requrements. It serves graphql over simple `GET` and `POST` requests
that accept `application/json`, but if the request is for `html`, then
it will server the `GraphiQL` IDE.

Since the raw http server is not used anymore, the code dedicated to
it has been removed.

[1]: https://graphql.org/learn/serving-over-http/#node
cowboyd referenced this issue in bigtestjs/server Jan 27, 2020
From https://github.com/bigtestjs/server/issues/29

> Rather than implement our own command interpreter we'll get one for
> free using GraphQL. This will allow us to not only get a command a
> query language (and response payload) with little effort, but we'll
> be able to use all of the tooling surrounding the GraphQL
> ecosystem (like the interactive webshell)

This uses the `graphql-express` packgage [recommended by
graphql.org][1] to implement a graphql endpoint that satisfies our
requrements. It serves graphql over simple `GET` and `POST` requests
that accept `application/json`, but if the request is for `html`, then
it will server the `GraphiQL` IDE.

Since the raw http server is not used anymore, the code dedicated to
it has been removed.

[1]: https://graphql.org/learn/serving-over-http/#node
@cowboyd cowboyd transferred this issue from bigtestjs/server Feb 21, 2020
@cowboyd
Copy link
Member Author

cowboyd commented Feb 21, 2020

This is done.

@cowboyd cowboyd closed this as completed Feb 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant