Skip to content

Commit

Permalink
First year photos uploaded
Browse files Browse the repository at this point in the history
  • Loading branch information
Akshit176022 committed Jan 2, 2025
1 parent 3c15c53 commit 3614ed9
Show file tree
Hide file tree
Showing 31 changed files with 342 additions and 213 deletions.
20 changes: 6 additions & 14 deletions apollo-server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import cors from 'cors';
import path from 'path';
import { fileURLToPath, pathToFileURL } from 'url';


const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);


const typeDefs = gql`
type Member {
name: String!
Expand Down Expand Up @@ -49,16 +47,15 @@ const typeDefs = gql`
}
`;


const resolvers = {
Query: {
members: async () => {
const { profileDetails } = await import(pathToFileURL(path.resolve(__dirname, './data/member_data.mjs')).href);
return profileDetails;
},
blogPosts: async () => {
// Implement logic for fetching blogPosts data
return []; // Placeholder, replace with actual data fetching logic
const { blogData } = await import(pathToFileURL(path.resolve(__dirname, './data/blog_posts.mjs')).href);
return blogData;
},
gallery: async () => {
const { data } = await import(pathToFileURL(path.resolve(__dirname, './data/data.mjs')).href);
Expand All @@ -67,31 +64,26 @@ const resolvers = {
},
};


const app = express();
app.use(cors({
origin: '*',
}));

app.use(cors({ origin: '*' }));

const startApolloServer = async () => {
const server = new ApolloServer({
typeDefs,
resolvers,
introspection: true,
playground: true,
introspection: true,
playground: true,
});

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

const PORT = 4000;
const PORT = 5000;
app.listen(PORT, () => {
console.log(`🚀 Server ready at http://localhost:${PORT}${server.graphqlPath}`);
});
};


startApolloServer().catch((err) => {
console.error('Error starting Apollo Server:', err);
});
Loading

0 comments on commit 3614ed9

Please sign in to comment.