NESTJS GraphQL APi

Group-2

A GraphQL APi for Bop-Consulting application.

Bop500 proposed architecture

Nest-JS-APi-Architect-2

NestJS GraphQL APi architecture link:

Group-3-1

GraphQL service browser

https://bop-consulting.herokuapp.com/graphql

TYPES (CitiesModel):

type CitiesModel {
  city_id: Float!
  city_name: String!
  state_id: Float!
  state_code: String!
  city_nominatim: String!
  state_name: String!
  country_id: Float!
  country_code: String!
  country_name: String!
  city_latitude: Float!
  city_longitude: Float!
  city_wikiDataId: String!
  bop_wikiDataId: String!
  city_population: String!
  city_osm_id: Float!
  city_administrative_level: Float
}

GET ENDPOINTS on GraphQL (Query)

type Query {
  // getAllCities query will return CitiesModel type data 
  getAllCities: [CitiesModel!]!
  // (city: String) is used as an argument on query which then filter out city that will be provided to the query
  getCity(city: String!): CitiesModel
}

Query examples

You can copy and paste the following examples to query

https://bop-consulting.herokuapp.com/graphql

Example 1 (get all city and country data query)

query {
  getAllCities {
    country_name
    city_name
    city_latitude
    city_longitude
    city_population
    city_id
    country_id
    country_code
    city_osm_id
    city_nominatim
    city_wikiDataId
    city_administrative_level
    state_id
    state_code
    state_name
  }
}

Example 2 (get one city detail query)

query {
  getCity(city: "Seattle") {
    country_name
    city_name
    city_latitude
    city_longitude
    city_population
    city_id
    country_id
    country_code
    city_osm_id
    city_nominatim
    city_wikiDataId
    city_administrative_level
    state_id
    state_code
    state_name
  }
}

Installation

$ npm install or yarn install

Running the app

# development
$ npm run start or yarn start

# watch mode
$ npm run start:dev or yarn start:dev

# production mode
$ npm run start:prod or yarn start:prod

Test

# unit tests
$ npm run test or yarn test

# e2e tests
$ npm run test:e2e or yarn test:e3e

# test coverage
$ npm run test:cov or yarn test:cov