All Projects → GraphQLGuide → graphql-rest-api-demo

GraphQLGuide / graphql-rest-api-demo

Licence: MIT license
A demo of what an equivalent REST API and GraphQL API look like.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to graphql-rest-api-demo

Blog Service
blog service @nestjs
Stars: ✭ 188 (+268.63%)
Mutual labels:  mongoose, graphql-server
Create Graphql
Command-line utility to build production-ready servers with GraphQL.
Stars: ✭ 441 (+764.71%)
Mutual labels:  mongoose, graphql-server
koa-server
🗄️ GraphQL Back-end Server with Relay, Koa, MongoDB and Mongoose
Stars: ✭ 31 (-39.22%)
Mutual labels:  mongoose, graphql-server
graphql-server-typescript
GraphQL + MongoDB express server with JWT authorization (in Typescript!)
Stars: ✭ 48 (-5.88%)
Mutual labels:  mongoose, graphql-server
showcase
A Full Stack Journey with Micro Services and Micro Front Ends. Using dapr, kubernetes, react module federation and web assembly,
Stars: ✭ 45 (-11.76%)
Mutual labels:  graphql-server
nuada-cli
Nuada CLI was designed to improve your development experience by using ExpressJS and Mongoose tools.
Stars: ✭ 19 (-62.75%)
Mutual labels:  mongoose
add-my-name
No more WhatsApp spams 🎉
Stars: ✭ 16 (-68.63%)
Mutual labels:  mongoose
Registration-and-Login-using-MERN-stack
Simple Registration and Login component with MERN stack
Stars: ✭ 210 (+311.76%)
Mutual labels:  mongoose
Apriliya-Api
Simple Web API with user authentication
Stars: ✭ 19 (-62.75%)
Mutual labels:  mongoose
Workshop-GraphQL
A GraphQL Server made for the workshop
Stars: ✭ 22 (-56.86%)
Mutual labels:  graphql-server
character-overlay
Web App for adding an OBS overlay with character information such as name, picture, and health for your favorite role-playing game.
Stars: ✭ 17 (-66.67%)
Mutual labels:  graphql-server
how-to-build-your-own-uber-for-x-app
Code for my blog post on How to Build Your Own Uber-for-X App
Stars: ✭ 138 (+170.59%)
Mutual labels:  mongoose
node-server-template
This is Node.js server tidy template / boilerplate with Express (with asyncified handlers, custom error handler) framework and MongoDb. The server use ES6 and above. On different branches you can see different techniques' and technologies' usage, such as Kafka, nodemailer, file download... You also can find postman collections.
Stars: ✭ 116 (+127.45%)
Mutual labels:  mongoose
code-examples
Example projects for my personal blog.
Stars: ✭ 144 (+182.35%)
Mutual labels:  mongoose
mongoose-slug-updater
Schema-based slug plugin for Mongoose - single/compound - unique over collection/group - nested docs/arrays - relative/abs paths - sync on change: create/save/update/updateOne/updateMany/findOneAndUpdate tracked - $set operator - counter/shortId
Stars: ✭ 37 (-27.45%)
Mutual labels:  mongoose
react-forum-system
React Forum System
Stars: ✭ 16 (-68.63%)
Mutual labels:  mongoose
Trellis
A simplified Trello clone built with React, Redux, Node, Express and MongoDB.
Stars: ✭ 116 (+127.45%)
Mutual labels:  mongoose
apollo-graphql-full-stack
Full-stack Apollo GraphQL app using React and Node JS
Stars: ✭ 31 (-39.22%)
Mutual labels:  graphql-server
graphql-express-nodejs
A Simple GraphQL Server implementation using Express and Node. See post here: https://t.co/Cm6GitZaBL
Stars: ✭ 24 (-52.94%)
Mutual labels:  graphql-server
bechdel-test
Does your favorite film pass the test?
Stars: ✭ 25 (-50.98%)
Mutual labels:  mongoose

GraphQL/REST API Demo

A demo of what an equivalent REST API and GraphQL API look like. This code is used in the first chapter of The GraphQL Guide by John Resig and Loren Sands-Ramshaw. Here's the GraphQL server's GraphiQL:

ch1.graphql.guide/graphql

Installation

To install you'll want to run npm install or yarn to install all of the Node modules.

Additionally, you'll need to have a copy of MongoDB running. If you're on OSX you can use Homebrew to install MongoDB by running: brew install mongodb. That should also start the database server in the background, as well. If it's not running you can run brew services start mongodb to start it.

You'll also want to populate the database with some data to test your queries. You can do this by running the mongo testdb command on the command-line and executing the following commands to create a new database, some collections, and the data inside of them:

db.users.insert({_id: "123", username: "jeresig", groupId: "dev"})
db.users.insert({_id: "456", username: "lorensr", groupId: "author"})
db.groups.insert({_id: "dev", name: "Developers"})
db.groups.insert({_id: "author", name: "Authors"})

By default the servers are expecting to find data on your local computer in a database named "testdb". You can configure this by changing the settings in models.js.

Data Models

Our data models representing the MongoDB database are in models.js. We use Mongoose to do the object modeling and provide a convenient way of accessing and mutating the data in the MongoDB collections.

REST API

The REST API is implemented using Node Express and provides a couple endpoints for accessing user data.

You can run it using:

node rest-server.js

You can access the REST API by opening your browser and visiting either of the following URLs:

GraphQL Server

The GraphQL server is implemented using Node Express, GraphQL.js, and GraphQL Express. It provides access to both the User and Group type.

You can run it using:

node graphql-server.js

You can access the GraphQL data by opening your browser and visiting the GraphiQL view at:

You should see a console interface into which you can run GraphQL queries and see their results. You should also be able to browse the full schema and see all of the types that are available to you and what data they provide.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].