I have successfully implemented a call to an API from a JSON file, and it is working fine. However, I am facing a problem where I need to change the path of the API in the JSON file without having to redeploy the application. I have tried to do this but it doesn't seem to work. Is there a way to implement this?
assets/config/config.json
{
"urls":{
"apiBaseUrl": "https://demored.ddns.net:59443",
"path": "/demored/api"
}
}
assets/config/config.ts
const config = require("./config.json");
export const URLS = Object({
"apiBaseUrl": config.urls.apiBaseUrl,
"path": config.urls.path
})
environment.prod.ts
import { URLS } from '../assets/api-url/config';
export const environment = {
production: true,
apiBaseUrl: URLS.apiBaseUrl,
path: URLS.path,
};