Skip to content
Snippets Groups Projects
Commit e8496b1b authored by Khalid, Rizwan (UG - Computer Science)'s avatar Khalid, Rizwan (UG - Computer Science)
Browse files

Initial commit for apollo gateway. Setup server and basic files

parent 3decd042
No related branches found
No related tags found
2 merge requests!8CI/CD,!5Apollo gateway
/*/node_modules
/*/.env
/*/build
/*/coverage
\ No newline at end of file
SECRET_KEY=SECRET_KEY_HERE
\ No newline at end of file
import { ApolloServer, PubSub } from 'apollo-server-express';
import express from 'express';
import cors from 'cors';
import bodyParser from 'body-parser';
import typeDefs from './graphql/typeDefs.js';
import resolvers from './graphql/resolvers/index.js'
import dotenv from 'dotenv';
dotenv.config();
const app = express();
app.use(bodyParser.json({ limit: "30mb", extended: true }));
app.use(bodyParser.urlencoded({ limit: "30mb", extended: true }));
app.use(cors());
const pubsub = new PubSub();
const server = new ApolloServer({
typeDefs,
resolvers,
context: ({ req }) => ({ req, pubsub })
});
server.applyMiddleware({ app, path: "/graphql" });
app.listen({ port: 5000 }, () => console.log("Apollo Server running on port 5000"));
\ No newline at end of file
This diff is collapsed.
{
"name": "apollo-gateway",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"apollo-server-express": "^2.23.0",
"axios": "^0.21.1",
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"graphql": "^15.5.0",
"jsonwebtoken": "^8.5.1"
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment