-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
33 lines (27 loc) · 858 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import * as path from "path";
import { ApolloServer } from "apollo-server";
import { makePrismaSchema } from "nexus-prisma";
import { prisma } from "./src/generated/prisma-client";
import datamodelInfo from "./src/generated/nexus-prisma";
const types = require("./src/schema/index");
const {typeDefs} = require('./src/generated/prisma-client/index.js');
const schema = makePrismaSchema({
types: [types],
prisma: {
datamodelInfo,
client: prisma,
},
outputs: {
schema: path.join(__dirname, "./src/generated/schema.graphql"),
typegen: path.join(__dirname, "./src/generated/nexus.ts"),
},
});
const server = new ApolloServer({
schema,
context: { prisma },
typeDefs
});
server.listen()
.then(({ url, server }) => {
console.log(`Server is running on http://localhost:4000`)
});