File tree Expand file tree Collapse file tree 6 files changed +56
-20
lines changed Expand file tree Collapse file tree 6 files changed +56
-20
lines changed Original file line number Diff line number Diff line change
1
+ NG_CLIENT_ID = <YOUR_NAVIGRAPH_CLIENT_ID>
2
+ NG_CLIENT_SECRET = <YOUR_NAVIGRAPH_CLIENT_SECRET>
Original file line number Diff line number Diff line change 1
1
# Logs
2
- logs
3
- * .log
4
- npm-debug.log *
5
2
yarn-debug.log *
6
3
yarn-error.log *
7
- pnpm-debug.log *
8
- lerna-debug.log *
9
4
10
5
node_modules
11
6
dist
12
- dist-ssr
13
7
* .local
14
8
15
9
# Editor directories and files
Original file line number Diff line number Diff line change 1
1
# Navigraph SDK Example
2
2
3
- WIP - more coming soon
3
+ ## Installation
4
+
5
+ Clone this repository to your local machine:
6
+
7
+ ``` bash
8
+ git clone https://github.com/Navigraph/navigraph-js-sdk.git
9
+
10
+ cd navigraph-js-sdk/examples/getting-started
11
+ ```
12
+
13
+ Install project dependencies using Yarn:
14
+
15
+ ``` bash
16
+ yarn
17
+ ```
18
+
19
+ Create an ` .env.local ` file in the root of your project and add the following environment variables:
20
+
21
+ ``` env
22
+ NG_CLIENT_ID=your_client_id
23
+ NG_CLIENT_SECRET=your_client_secret
24
+ ```
25
+
26
+ Make sure to replace ` your_client_id ` and ` your_client_secret ` with your real credentials. These variables are required for the project to function correctly.
27
+
28
+ ## Running the Project
29
+
30
+ To start the development server, run the following command:
31
+
32
+ ``` bash
33
+ yarn dev
34
+ ```
Original file line number Diff line number Diff line change 1
- import { initializeApp , Scope , NavigraphApp } from "@navigraph/app" ;
2
- import { getAuth } from "@navigraph/auth" ;
3
- import { getChartsAPI } from "@navigraph/charts" ;
1
+ import { initializeApp , NavigraphApp , Scope } from "@navigraph/app"
2
+ import { getAuth } from "@navigraph/auth"
3
+ import { getChartsAPI } from "@navigraph/charts"
4
4
5
5
const config : NavigraphApp = {
6
- clientId : "<YOUR_NAVIGRAPH_CLIENT_ID>" ,
7
- clientSecret : "<YOUR_NAVIGRAPH_CLIENT_SECRET>" ,
6
+ clientId : import . meta . env . NG_CLIENT_ID ,
7
+ clientSecret : import . meta . env . NG_CLIENT_SECRET ,
8
8
scopes : [ Scope . CHARTS , Scope . FMSDATA ] ,
9
- } ;
9
+ }
10
10
11
11
if ( config . clientId . includes ( "<" ) ) {
12
- alert ( "Please add your client credentials in lib/navigraph.ts." ) ;
12
+ alert ( "Please add your client credentials in lib/navigraph.ts." )
13
13
}
14
14
15
- initializeApp ( config ) ;
15
+ initializeApp ( config )
16
16
17
- export const auth = getAuth ( ) ;
18
- export const charts = getChartsAPI ( ) ;
17
+ export const auth = getAuth ( )
18
+ export const charts = getChartsAPI ( )
Original file line number Diff line number Diff line change 1
1
/// <reference types="vite/client" />
2
+
3
+ interface ImportMetaEnv {
4
+ readonly NG_CLIENT_ID : string
5
+ readonly NG_CLIENT_SECRET : string
6
+ }
7
+
8
+ interface ImportMeta {
9
+ readonly env : ImportMetaEnv
10
+ }
Original file line number Diff line number Diff line change 1
- import { defineConfig } from 'vite'
2
- import react from '@vitejs/plugin-react'
1
+ import react from "@vitejs/plugin-react"
2
+ import { defineConfig } from "vite"
3
3
4
- // https://vitejs.dev/config/
5
4
export default defineConfig ( {
6
5
plugins : [ react ( ) ] ,
6
+ envPrefix : "NG_" ,
7
7
} )
You can’t perform that action at this time.
0 commit comments