{"size": 709, "ext": "js", "max_stars_repo_path": "src/app.js", "max_stars_repo_name": "slice-and-dice/register-a-food-business-service", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/app.js", "max_issues_repo_name": "slice-and-dice/register-a-food-business-service", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/app.js", "max_forks_repo_name": "slice-and-dice/register-a-food-business-service", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.3214285714, "max_line_length": 72, "alphanum_fraction": 0.6614950635}
const express = require("express");
const graphQL = require("express-graphql");
const winston = require("winston");
const schema = require("./schema.js");
const voyagerMiddleware = require("graphql-voyager/middleware").express;

const app = express();
const port = process.env.PORT || 4000;
app.use(
  "/graphql",
  graphQL({
    schema,
    graphiql: true,
    formatError: error => ({
      message: error.message,
      state: error.originalError && error.originalError.state,
      locations: error.locations,
      path: error.path
    })
  })
);

app.use("/voyager", voyagerMiddleware({ endpointUrl: "/graphql" }));

app.listen(port, () => {
  winston.info(`App Started listening on port ${port}`);
});
