Giter Club home page Giter Club logo

hm-graphql-auto-api-explorer's Introduction

High Mobility GraphQL sample app

This repo includes a Node.js app, which features a vehicle dashboard and demonstrates how to use the High Mobility GraphQL API.

Table of contents

Getting started

Deploy to Heroku

Deploy

Where to find config information

Step 0: Make sure you have this sample app deployed. Once you load the root URL, you will be presented to configure it.

General Setup

  1. Go to high-mobility.com and create an account or sign in
  2. Create a Cloud App under the Develop tab. For exact details, have a look at the Create App step in our docs.
  3. Choose the Client Certificate tab and then the GraphQL tab as shown in the screenshot below.

  1. Second, you need to insert the OAuth2 configuration, which you will find under My Settings/Team Settings > OAuth Client. Note that for Cloud Apps created under the Production tab, the OAuth2 configuration is listed directly in the app details view.
  2. In the same OAuth2 page, add the Redirect URI that is listed at the end of the configuration form of this app. This way you are redirected back to the app once the consent flow has finished.

Fleet apps

  1. For fleet apps you will also need to insert fleet config. To download the JSON open your production app, then the service account keys tab, then click on the "+" button to download the config.
  2. After initializing your app and adding a vehicle, click on the refresh button to refresh the vehicle's fleet clearance status. To automatically update this status, configure a webhook in the settings view.

Local setup

0. Requirements

  • Node 16.14
  • Postgres database

1. Start API

  • npm i
  • cp .env.example .env
  • Add database credentials to .env
  • npx knex migrate:latest
  • npm start

2. Start client (in new window)

  • cd client
  • npm i
  • npm start

Creating and running migrations

npx knex migrate:make my_first_migration

npx knex migrate:latest

npx knex migrate:rollback --all

Generating new config files

node generateConfig && cd client && npm i

Full documentation

Using behind a reverse proxy

When deployed behind a reverse proxy (like haproxy or nginx) requires the rewrite of the host header in the configuration of the reverse proxy, for connections towards the backend.

For haproxy

http-request set-header Host "your.fixed.hostname"

(see https://www.haproxy.com/documentation/hapee/latest/traffic-routing/rewrites/rewrite-requests/#set-a-header)

For nginx

proxy_set_header Host "your.fixed.hostname";

(see https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_set_header)

Contributing

We would love to accept your patches and contributions to this project. Before getting to work, please first discuss the changes that you wish to make with us via GitHub Issues or Slack.

See more in CONTRIBUTING.md

License

This repository is using MIT license. See more in LICENSE

hm-graphql-auto-api-explorer's People

Contributors

kaareloun avatar kevinvaldek avatar scudelletti avatar rs38 avatar slashmili avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.