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.
21 lines
526 B
21 lines
526 B
5 years ago
|
import express = require("express")
|
||
5 years ago
|
import { ApolloServer } from "apollo-server-express"
|
||
5 years ago
|
import { createSchema } from "./server/schema"
|
||
|
import { contextFunction } from "./server/userResolver/auth"
|
||
5 years ago
|
|
||
5 years ago
|
export const createServer = async (port: number) => {
|
||
5 years ago
|
const server = new ApolloServer({
|
||
|
schema: await createSchema(),
|
||
|
playground: true,
|
||
|
introspection: true,
|
||
|
debug: true,
|
||
5 years ago
|
context: contextFunction,
|
||
5 years ago
|
})
|
||
5 years ago
|
|
||
5 years ago
|
const app = express()
|
||
|
server.applyMiddleware({ app })
|
||
5 years ago
|
app.listen({ port })
|
||
5 years ago
|
|
||
5 years ago
|
return server
|
||
|
}
|