Skip to content

A dynamic API service support custom your response fields, filter, sorting.

License

Notifications You must be signed in to change notification settings

max9159/dynamic-api-exercises

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dynamic-api-exercises

Abstract

A dynamic API service supports custom response fields, filter, and sorting and is written in GraphQL and NodeJS. Due to the short schedule, I choose to implement it on the application directly without DataBase(another dependency) to quickly finish the PoC.

Installation

npm install

Getting Started

  • To start API service.
npm start

API Testing Example

?query=query($filter:Filter!,$sort:Sort){
    salaries(filter:$filter,sort:$sort)
    {timestamp,jobTitle,annualBasePay}
  }
  &variables={
    "filter":{"jobTitle":"Engineer","timestamp_lte":"1458566204000"},
    "sort":{"timestamp":"DESC"}
    }
  • Custom fields
    • salaries(filter:$filter,sort:$sort){timestamp,jobTitle,annualBasePay}
  • Filter
    • &variables={"filter":{"jobTitle":"Engineer","timestamp_lte":"1458566204000"}}
    • timestamp_lte
      • Need to use the new Date().getTime() in javascript.
  • Sort
    • &variables={"filter":{"jobTitle":"Engineer","timestamp_lte":"1458566204000"},"sort":{"timestamp":"DESC"}}

Preview

  • Run server and send GET Request via HTTP Client Extension. StartServerAndInvokeAPI
  • Use GET API with Chrome. InvokeAPIwithChrome

About

A dynamic API service support custom your response fields, filter, sorting.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published