import * as express from "express"; import * as graphqlHTTP from "express-graphql"; import {buildSchema} from "graphql"; import { GameServer } from "./GameServer"; const port = 8080; const apiRoot = "/graphql"; const app = express(); const schema = buildSchema(` type MazeTile { id: String! paths: [Int!]! } type Query { currentPostition(userID: String!): MazeTile } `); const games = new GameServer(); const root = { currentPostition: ({userID}) => games.currentPosition(userID), }; app.use(apiRoot, graphqlHTTP({ graphiql: true, rootValue: root, schema, })); app.listen(port, () => console.log(`App listening on port ${port}...`));