You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
634 B
23 lines
634 B
import express = require("express")
|
|
import { ApolloServer } from "apollo-server-express"
|
|
import { createSchema } from "./server/schema"
|
|
import { contextFunction } from "./server/userResolver/auth"
|
|
|
|
export const createServer = async (port: number) => {
|
|
const server = new ApolloServer({
|
|
schema: await createSchema(),
|
|
playground: true,
|
|
introspection: true,
|
|
debug: true,
|
|
context: contextFunction,
|
|
})
|
|
|
|
const app = express()
|
|
app.post("/refresh_token", (_req, res) =>
|
|
res.send({ data: null, errors: "Invalid access token" })
|
|
)
|
|
server.applyMiddleware({ app })
|
|
app.listen({ port })
|
|
|
|
return server
|
|
}
|
|
|