Dev Grill
  • Home
  • Remote Jobs
  • Coding Interview
  • Privacy Policy
Dev Grill
  • Home
  • Remote Jobs
  • Coding Interview
  • Privacy Policy
  • Javascript
  • JWT

How to generate test data using JSON Server and Mockeroo for Graphql application

  • August 16, 2019
  • 2 comments
  • 1 minute read
  • 678 views
  • Osuagwu Emeka
How to generate test data using JSON Server and Mockeroo for Graphql application
Total
0
Shares
0
0
0
0
0
0

Objective

Learn how to generate random JSON data to test your Graphql scheme using JSON server and Mockaroo.

Prerequisites

  • NodeJs installed
  • expecting you to have intermediate knowledge of Javascript
  • Terminal (any will do, preferably bash-based)
  • A text editor (any will do)

Let’s get started

Create a project directory for the app.

mkdir simple_node_graphql_app && cd simple_node_graphql_app

install the local npm dependencies we require

npm install --save axios express express-graphql graphql nodemon

install global npm dependencies (read all about json-server)

npm install -g json-server

Generating test json data with Mockaroo

Step 1

Generate fields test data eg (id, firstName, lastName, age, image, gender)

Step 2

create a db.json file

update the db.json file with the data generated or download from mockaroo from step one.

Now let’s start our servers and see how far our applications are doing.

npm run dev
goto http://localhost:4000/graphql on your browser
npm run js-server

Now we test the graphql query in our browser

if you got this far, you’re awesome.

Click here to clone and run the above app yourself.

I would love to hear your feedback and thoughts, also feel free to relate any issues you have.

How to thank me?

  • give this article a clap
  • follow me on twitter
  • tweet, share this lesson with 3 friends
  • star the project on github

Hope you’ll find this useful! Thanks

Total
0
Shares
Share 0
Tweet 0
Share 0
Share 0
Share 0
Share 0
Next Article
Laravel Vuejs Realtime Chat
  • Javascript
  • Laravel
  • PHP
  • Redis
  • Vuejs

Real time (one to one) Chat App with Vuejs and Laravel – Part 1

  • September 2, 2019
  • Osuagwu Emeka
View Post
You May Also Like
View Post
  • Javascript
  • React Native

How to use device Camara with React Native apps

  • July 30, 2020
  • Osuagwu Emeka
View Post
  • Javascript
  • Vuejs

Vuejs show and hiding password input for users

  • October 17, 2019
  • Osuagwu Emeka
View Post
  • Javascript
  • Vuejs

Filtering Data The Vue Way

  • October 5, 2019
  • Osuagwu Emeka
Laravel Vuejs Realtime Chat
View Post
  • Javascript
  • Laravel
  • PHP
  • Redis
  • Vuejs

Real time (one to one) Chat App with Vuejs and Laravel – Part 1

  • September 2, 2019
  • Osuagwu Emeka
2 comments
  1. Avatar Orval says:
    May 11, 2020 at 6:53 pm

    This site was… how do I say it? Relevant!! Finally I’ve found something that helped me. Cheers!|

    Reply
  2. Avatar ปั้มไลค์ says:
    May 23, 2020 at 9:51 am

    Like!! I blog frequently and I really thank you for your content. The article has truly peaked my interest.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts
  • Remote Information Technology Jobs October 14, 2020
  • Remote Technical Recruiter Job October 14, 2020
  • Remote Web Design Jobs October 14, 2020
  • What Does Remote Job mean? October 14, 2020
  • How to Find Remote Jobs October 14, 2020
Looking for something
Dev Grill
  • Home
  • Remote Jobs
  • Coding Interview
  • Privacy Policy
Learn and solve practical coding challenges

Input your search keywords and press Enter.