-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmain.ts
More file actions
32 lines (26 loc) · 758 Bytes
/
main.ts
File metadata and controls
32 lines (26 loc) · 758 Bytes
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
import { startPlugin } from 'erxes-api-shared/utils';
import { typeDefs } from '~/apollo/typeDefs';
import { appRouter } from '~/trpc/init-trpc';
import resolvers from './apollo/resolvers';
import { generateModels } from './connectionResolvers';
startPlugin({
name: 'operation',
port: 33010,
graphql: async () => ({
typeDefs: await typeDefs(),
resolvers,
}),
apolloServerContext: async (subdomain, context) => {
const models = await generateModels(subdomain);
context.models = models;
return context;
},
trpcAppRouter: {
router: appRouter,
createContext: async (subdomain, context) => {
const models = await generateModels(subdomain);
context.models = models;
return context;
},
},
});