mirror of
https://github.com/IT4Change/boilerplate-backend.git
synced 2025-12-13 10:25:49 +00:00
19 lines
442 B
TypeScript
19 lines
442 B
TypeScript
import { ApolloServer } from '@apollo/server'
|
|
import { startStandaloneServer } from '@apollo/server/standalone'
|
|
|
|
import { schema } from '#graphql/schema'
|
|
|
|
export const createServer = async (): Promise<ApolloServer> => {
|
|
return new ApolloServer({
|
|
schema: await schema(),
|
|
})
|
|
}
|
|
|
|
export async function listen(port: number) {
|
|
const { url } = await startStandaloneServer(await createServer(), {
|
|
listen: { port },
|
|
})
|
|
|
|
return url
|
|
}
|