Go GraphQL
Simple vanilla Go CRUD application with mongoDB database with its mflix dataset that I use for my thesis about benchmarking REST API and GraphQL.
Usage
To use this application run:
go run main.go
The server will be served at http://localhost:8082
.
To run the query and mutation send a JSON POST request to the server. Below are sample queries for existing GraphQL query and mutation in this application.
Movies Query
{
"query": "{ movies (limit: 1) { _id, plot, genres, runtime, casts, num_mflix_comments, title, fullplot, countries, released, directors, writers, rated, awards { wins, nominations, text }, lastupdated, year, imdb { rating, votes, id }, type, tomatoes { viewer { rating, numReviews, meter }, dvd, critic { rating, numReviews, meter } lastUpdated, rotten, production, fresh } } }"
}
Create Comment Mutation
{
"query": "mutation { createComment (name: \"John Doe\", email: \"[email protected]\", movie_id: \"573a1390f29313caabcd418c\", text: \"Test\") }"
}
Update Comment Mutation
{
"query": "mutation { updateComment (_id: \"61587274f17300008f003857\", name: \"John Doe 2\", email: \"[email protected]\", movie_id: \"573a1390f29313caabcd418c\", text: \"Test 2\") }"
}
Delete Comment Mutation
{
"query": "mutation { deleteComment (_id: \"615872288270000002002917\") }"
}
Related Repository
Below is another repository used for my thesis.