sagarshetty381 / gsmarena-graphql

This API is implemented with graphQL which web scrapes data from GSMArena

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NodeJS GraphQL API with apollo server

This API is implemented with graphQL which web scrapes data from https://gsmarena.com

Installation

npm i

Run application

npm run start

To test the API queries, click on http://localhost:4000/graphql

Guide for the API

To get all the brand names

getAllBrands {
    name
    slug
  }

To get the list of mobile phones

  getDevicesByBrand(brandSlug: $brandSlug) {
    imageUrl
    productName
    slug
  }

brandSlug :- Slug received from the respective brands from getAllBrands call

To get the mobile phones details

  getDeviceDetails(mobileSlugs: $mobileSlugs) {
    products  
    title
  }

mobileSlug :- Slug received from the repective mobiles from getDevicesByBrand call

The above calls can also be combined as below. (feel free to playaround)

getAllBrands(brandName: $brandName) {
    name
    device {
      imageUrl
      productName
      deviceDetails {
        products
        title
      }
    }
  }

This gets the list of all the mobiles of the specified brands with details.

About

This API is implemented with graphQL which web scrapes data from GSMArena


Languages

Language:TypeScript 100.0%