Skip to content

Commit

Permalink
Replace playground with graphiql
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoftek committed Oct 27, 2018
1 parent 147d109 commit 1cc2eac
Show file tree
Hide file tree
Showing 39 changed files with 32 additions and 37,860 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Generate GraphQL schemas and server based on SQL table structure.
`sql-to-graphql` is a command-line utility that can help you get started. You give it the credentials to an SQL database (MySQL, PostgreSQL and SQLite currently) and it will inspect the tables it finds and do the following:

- Generate GraphQL-types for each table (including resolvers)
- Generate an HTTP-server based on Hapi that accepts GraphQL queries
- Sets up a basic web-frontend that lets you query the server
- Generate an HTTP-server based on Express that accepts GraphQL queries
- Exposes a graphiql playground to query the server

## Disclaimer

Expand All @@ -28,7 +28,6 @@ This utility is intended to help people get started with GraphQL. It is **NOT**

- `--relay`, `-r` - Generate Relay-style schema *`(boolean [default: false])`*
- `--output-dir`, `-o` - Directory to use when generating app *`(string [required])`*
- `--es6` - Use ES6 for generated code *`(boolean [default: false])`*
- `--database`, `--db` - Database name *`(string [required])`*
- `--db-filename` - Database filename, used for SQLite *`(string)`*
- `--host`, `-h` - Hostname of database server *`(string [default: "localhost"])`*
Expand Down
5 changes: 0 additions & 5 deletions cli/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ module.exports = {

styleOptions: function(opts, cb) {
return inquirer.prompt([{
type: 'confirm',
message: 'Do you want to use babel + ES6?',
name: 'es6',
default: opts.es6
}, {
type: 'confirm',
name: 'relay',
message: 'Do you want a Relay-style GraphQL schema?',
Expand Down
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions server/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const express = require('express')
const graphqlHTTP = require('express-graphql')
const MyGraphQLSchema = require('./schema.js')

const app = express()

app.use(
'/graphql',
graphqlHTTP({
schema: MyGraphQLSchema,
graphiql: true
})
)

app.listen(4000, () => {
console.log('listening on port 4000...')
})
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions steps/ast-builders/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = function buildConfig(opts) {
};

function getConfigAst(opts) {

return b.objectExpression([
b.property('init', b.identifier('client'), b.literal(opts.backend)),
b.property('init', b.identifier('connection'), buildObject(
Expand Down
9 changes: 9 additions & 0 deletions steps/copy-server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

var copy = require('copy-dir');
var path = require('path');

module.exports = function copyServer( toDir) {
var fromDir = path.resolve(path.join(__dirname, '..', 'server'));
copy.sync(fromDir, toDir);
};
11 changes: 0 additions & 11 deletions steps/copy-templates.js

This file was deleted.

6 changes: 3 additions & 3 deletions steps/output-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var buildResolveMap = require('./ast-builders/resolve-map');
var buildSchemaModule = require('./ast-builders/schema-module');
var buildNodeDefinitions = require('./ast-builders/node-definitions');
var updatePackageManifest = require('./update-package');
var copyTemplates = require('./copy-templates');
var copyServer = require('./copy-server');

function outputData(data, opts, callback) {
if (opts.relay) {
Expand Down Expand Up @@ -64,8 +64,8 @@ function outputData(data, opts, callback) {
var resolveMap = recast.prettyPrint(buildResolveMap(data, opts), opts).code;
fs.writeFileSync(path.join(outputDir, 'resolve-map.js'), resolveMap);

// Copy templates ("static" ones, should probably be named something else)
copyTemplates(opts.es6 ? 'es6' : 'cjs', outputDir);
// Copy server files
copyServer( outputDir);

// Write the schema!
var schemaCode = recast.prettyPrint(buildSchemaModule(data, opts), opts).code;
Expand Down
38 changes: 0 additions & 38 deletions templates/cjs/handlers/graphql.js

This file was deleted.

8 changes: 0 additions & 8 deletions templates/cjs/handlers/schema-printer.js

This file was deleted.

24 changes: 0 additions & 24 deletions templates/cjs/package.json

This file was deleted.

38 changes: 0 additions & 38 deletions templates/cjs/server.js

This file was deleted.

9 changes: 0 additions & 9 deletions templates/es6/.eslintrc

This file was deleted.

13 changes: 0 additions & 13 deletions templates/es6/db.js

This file was deleted.

36 changes: 0 additions & 36 deletions templates/es6/handlers/graphql.js

This file was deleted.

6 changes: 0 additions & 6 deletions templates/es6/handlers/schema-printer.js

This file was deleted.

2 changes: 0 additions & 2 deletions templates/es6/index.js

This file was deleted.

25 changes: 0 additions & 25 deletions templates/es6/package.json

This file was deleted.

36 changes: 0 additions & 36 deletions templates/es6/server.js

This file was deleted.

Loading

0 comments on commit 1cc2eac

Please sign in to comment.