Skip to content

Commit 3614ed9

Browse files
committedJan 2, 2025·
First year photos uploaded
1 parent 3c15c53 commit 3614ed9

31 files changed

+342
-213
lines changed
 

‎apollo-server.mjs

+6-14
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ import cors from 'cors';
44
import path from 'path';
55
import { fileURLToPath, pathToFileURL } from 'url';
66

7-
87
const __filename = fileURLToPath(import.meta.url);
98
const __dirname = path.dirname(__filename);
109

11-
1210
const typeDefs = gql`
1311
type Member {
1412
name: String!
@@ -49,16 +47,15 @@ const typeDefs = gql`
4947
}
5048
`;
5149

52-
5350
const resolvers = {
5451
Query: {
5552
members: async () => {
5653
const { profileDetails } = await import(pathToFileURL(path.resolve(__dirname, './data/member_data.mjs')).href);
5754
return profileDetails;
5855
},
5956
blogPosts: async () => {
60-
// Implement logic for fetching blogPosts data
61-
return []; // Placeholder, replace with actual data fetching logic
57+
const { blogData } = await import(pathToFileURL(path.resolve(__dirname, './data/blog_posts.mjs')).href);
58+
return blogData;
6259
},
6360
gallery: async () => {
6461
const { data } = await import(pathToFileURL(path.resolve(__dirname, './data/data.mjs')).href);
@@ -67,31 +64,26 @@ const resolvers = {
6764
},
6865
};
6966

70-
7167
const app = express();
72-
app.use(cors({
73-
origin: '*',
74-
}));
75-
68+
app.use(cors({ origin: '*' }));
7669

7770
const startApolloServer = async () => {
7871
const server = new ApolloServer({
7972
typeDefs,
8073
resolvers,
81-
introspection: true,
82-
playground: true,
74+
introspection: true,
75+
playground: true,
8376
});
8477

8578
await server.start();
8679
server.applyMiddleware({ app, path: '/graphql' });
8780

88-
const PORT = 4000;
81+
const PORT = 5000;
8982
app.listen(PORT, () => {
9083
console.log(`🚀 Server ready at http://localhost:${PORT}${server.graphqlPath}`);
9184
});
9285
};
9386

94-
9587
startApolloServer().catch((err) => {
9688
console.error('Error starting Apollo Server:', err);
9789
});

0 commit comments

Comments
 (0)