This app combines the following two libraries into one express server that can accept GraphQL requests to MongoDB:
- Local installation of MongoDB
- (OR) Docker
Clone the app using the following command:
git clone https://github.com/dflor003/graphql-anywhere-mongodb-example
Set the APP_MONGO
environment variable in /.env
at the root of the project to the connection string to your mongo instance.
Then start the app by running:
npm run start:dev
Ensure you have a recent version of docker and have access to the docker-compose
command and then run the following command:
npm run start:docker
Once the app is running, navigate to the app at http://localhost:3000
.
You can test it out using this sample dataset or any local dataset you have.
If you go for a local collection, do be sure to update the whitelist
variable in server.ts
with the name(s) of the collection(s) you are querying or get rid of the whitelist value altogether.