-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
31 lines (28 loc) · 845 Bytes
/
main.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
// @deno-types="npm:@types/express@4"
import express from "npm:[email protected]";
import { x } from "npm:[email protected]"; // currently graphql is not automatically imported but necessary to run
import { ApolloServer, gql } from "npm:[email protected]";
import { buildSubgraphSchema } from "npm:@apollo/[email protected]";
const port = 8765;
const app = express();
const server = new ApolloServer({
schema: buildSubgraphSchema({
typeDefs: gql`
extend type Query {
hello: String!
}`,
resolvers: {
Query: {
hello: () => "world",
},
},
}),
});
(async () => {
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
await server.start();
server.applyMiddleware({ app });
console.log(`App Started. Listening on Port ${8765}`);
})();
app.listen({ port });