Skip to content

An example of how to migrate a traditional REST API to GraphQL

Notifications You must be signed in to change notification settings

barretodavid/rest-to-graphql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

REST API to GraphQL Example

This code is an example of how to migrate a traditional REST API to GraphQL using the API of jsonplaceholder as a reference.

Requirements

  • Node 7.6+
  • MongoDB
  • Yarn

Installation

Make sure to have mongodb installed.

To start the mongodb server run:

$ mongod

After clonning the project run:

$ yarn install // install project dependencies
$ yarn build   // transpile code from typescript to js (ES6)
$ yarn loader  // populate mongodb with data from jsonplaceholder API
$ yarn start   // start koa server with graphql

An express server will be up and running in the port 3000.

Open your browser and go tohttp://localhost:3000/graphql to start playing with the graphiql GUI

Development

If you want to modify the code, open a new terminal window and run the typescript transpiler in watch mode:

$ yarn build:watch

About

An example of how to migrate a traditional REST API to GraphQL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published