This commit is contained in:
Niklas Fondberg
2021-04-06 09:56:18 +02:00
parent a1280f4c0e
commit 4532fbc853
12 changed files with 5506 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
import dotenv from 'dotenv';
dotenv.config();
import { ApolloServer } from 'apollo-server';
import { dbConfig } from './config';
import { typeDefs } from './schema';
import resolvers from './resolvers';
import { OrderAPI } from './datasources/order';
// set up any dataSources our resolvers need
const dataSources = () => ({
orderApi: new OrderAPI(dbConfig),
});
const context = async ({ req }) => {
return { data: { foo: 'bar' } };
};
async function main() {
const server = new ApolloServer({
typeDefs,
resolvers,
dataSources,
context,
introspection: true,
playground: true,
});
await server.listen();
console.log('Server is running on http://localhost:4000');
}
main();