This is the GraphQL server implementation used in Front End Masters' GraphQL workshop. It contains GraphQL queries and mutations to handle CRUD operations on a courses and students resource. MongoDB is used to persist the data and a connection to mLab is provided.
Clone the repo, install the dependencies, and run the server.
npm i
# for live reload
npm run dev
# for prod
npm start
The app will be served at localhost:8080
and GraphiQL can be accessed at localhost:8080/graphql
.
There is a .env
file included with a connection string to an mLab database. Normally the .env
file would not be committed and any access to a remote server would be hidden. The database used for this example is a throwaway. For the sake of getting started quickly, it is easier to provide direct access to a working database out of the box.
If you will be publishing work based on this example, be sure to keep any database credentials out of source control.
Some static data is provided for the getting started examples during the workshop.
To use your own mLab database, change the connection string value for MLAB_URL
in the .env
file. Read the mLab docs to get started if you are unfamiliar with it.
MIT