sdy

add passport into server

...@@ -3,6 +3,8 @@ dotenv.config(); ...@@ -3,6 +3,8 @@ dotenv.config();
3 import { GraphQLServer } from "graphql-yoga"; 3 import { GraphQLServer } from "graphql-yoga";
4 import morgan from "morgan"; 4 import morgan from "morgan";
5 import schema from "./schema"; 5 import schema from "./schema";
6 +import "./passport";
7 +import { authenticateJWT } from "./passport";
6 8
7 const PORT = process.env.PORT; 9 const PORT = process.env.PORT;
8 10
...@@ -12,5 +14,6 @@ const server = new GraphQLServer({ ...@@ -12,5 +14,6 @@ const server = new GraphQLServer({
12 }); 14 });
13 15
14 server.express.use(morgan("dev")); 16 server.express.use(morgan("dev"));
17 +server.express.use(authenticateJWT);
15 18
16 server.start(() => console.log(`server is running : http://localhost:${PORT}`)); 19 server.start(() => console.log(`server is running : http://localhost:${PORT}`));
......