diff --git a/package.json b/package.json index bf6de2f..42d3989 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,6 @@ "@types/cors": "^2.8.7", "@types/express": "^4.17.7", "@types/faker": "^5.1.0", - "@types/ip": "^1.1.0", "@types/lodash": "^4.14.159", "@types/morgan": "^1.9.1", "@types/node": "^14.6.0", @@ -62,7 +61,6 @@ "dotenv": "^8.2.0", "faker": "^5.1.0", "http-proxy-middleware": "^1.0.5", - "ip": "^1.1.5", "rimraf": "^3.0.2", "webpack-node-externals": "^2.5.1" }, diff --git a/src/core/constants/urls.ts b/src/core/constants/urls.ts index 8ece5f3..6a2cb8a 100644 --- a/src/core/constants/urls.ts +++ b/src/core/constants/urls.ts @@ -1,5 +1,3 @@ -import { address } from 'ip'; export const API_PORT = 3001; -export const API_URL = `http://${address()}:${API_PORT}`; export const CLIENT_DEV_URL = 'http://localhost:3000'; diff --git a/src/index.tsx b/src/index.tsx index 09bb63c..525c06c 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,22 +1,23 @@ -import axios from "axios"; -import React from "react"; -import ReactDOM from "react-dom"; -import App from "./client/App"; -import "./index.css"; -import * as serviceWorker from "./client/serviceWorker"; -import { API_URL } from "./core/constants/urls"; +import axios from 'axios'; +import React from 'react'; +import ReactDOM from 'react-dom'; +import App from './client/App'; +import './index.css'; +import * as serviceWorker from './client/serviceWorker'; +import { API_PORT } from './core/constants/urls'; -const isDevelopmentMode = process.env.NODE_ENV === "development"; +const isDevelopmentMode = process.env.NODE_ENV === 'development'; if (isDevelopmentMode) { - axios.defaults.baseURL = API_URL; + console.log(window.location); + axios.defaults.baseURL = `http://${window.location.hostname}:${API_PORT}`; } ReactDOM.render( // , // - document.getElementById("root") + document.getElementById('root'), ); // If you want your app to work offline and load faster, you can change