diff --git a/.gitignore b/.gitignore index aebf205..b73f19b 100644 --- a/.gitignore +++ b/.gitignore @@ -13,8 +13,11 @@ # Go workspace file go.work + *.DS_Store *package-lock.json vendor *.expo *node_modules + +*.env diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a73fdb0..5805b47 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,6 +6,7 @@ repos: - id: check-added-large-files - id: check-merge-conflict - id: end-of-file-fixer + exclude: 'backend/docs/' - id: trailing-whitespace - id: no-commit-to-branch args: ['--branch', 'main'] diff --git a/README.md b/README.md index 8157b15..0a6a3c7 100644 --- a/README.md +++ b/README.md @@ -79,16 +79,14 @@ process can vary, so follow the instructions for each item below! - This will generate the swagger docs as well as start the backend - You can now view swagger: http://localhost:8080/swagger/index.html -5. Next, open one last tab to run commands in: run `task start-ngrok` +5. Next, create a .env file in the root directory with a single line: + `EXPO_PUBLIC_API_DOMAIN={your ngrok static domain here}` -- This will just give you a prompt to enter your ngrok domain for example mine - is: +6. Next, open one last tab to run commands in: run `task start-ngrok` - `kind-dane-roughly.ngrok-free.app` - -6. Next, open another new tab to run commands in: run `task start-frontend` +7. Next, open another new tab to run commands in: run `task start-frontend` - This will start the frontend -7. From here follow the prompt in step 6 to launch the frontend on your device +8. From here follow the prompt in step 6 to launch the frontend on your device of choice diff --git a/Taskfile.yaml b/Taskfile.yaml index 24ec15f..fb9b710 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -1,5 +1,5 @@ version: '3' - +dotenv: ['.env'] tasks: build: - | @@ -30,11 +30,11 @@ tasks: npm start start-ngrok: - - | - cd backend - echo "Type ngrok domain name:" - read ngrok; - ngrok http --domain=${ngrok} 8080 + dotenv: ['.env'] + cmds: + - | + cd backend + ngrok http --domain=$EXPO_PUBLIC_API_DOMAIN 8080 start-docker: - | diff --git a/backend/docs/swagger.json b/backend/docs/swagger.json index 58eaa73..b0a755a 100644 --- a/backend/docs/swagger.json +++ b/backend/docs/swagger.json @@ -42,4 +42,4 @@ } } } -} +} \ No newline at end of file diff --git a/client/config.json b/client/config.json deleted file mode 100644 index c264000..0000000 --- a/client/config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "api-link": "https://kind-dane-roughly.ngrok-free.app" -} diff --git a/client/services/api-links.ts b/client/services/api-links.ts new file mode 100644 index 0000000..298d3f1 --- /dev/null +++ b/client/services/api-links.ts @@ -0,0 +1 @@ +export const api_url = `https://${process.env.EXPO_PUBLIC_API_DOMAIN}`; diff --git a/client/services/medication.ts b/client/services/medication.ts index ff05ebd..b2fbdd6 100644 --- a/client/services/medication.ts +++ b/client/services/medication.ts @@ -1,8 +1,7 @@ import axios from 'axios'; - -import config from '../config.json'; +import { api_url } from './api-links'; export const getAllMedications = async (): Promise => { - const response = await axios.get(`${config['api-link']}/medications`); + const response = await axios.get(`${api_url}/medications`); return response.data; };