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.
20 lines
526 B
20 lines
526 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()
|
|
server.applyMiddleware({ app })
|
|
app.listen({ port })
|
|
|
|
return server
|
|
}
|
|
|