Skip to content

Commit

Permalink
configured axios base url for dynamic environments
Browse files Browse the repository at this point in the history
  • Loading branch information
alxford45 committed Nov 29, 2020
1 parent 9cc8177 commit 5d0e7ae
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion client/src/api/api.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import axios from "axios";

/*
If serve static dev -> host = localhost:3000
If concurrent dev -> host = localhost:5000
If production -> host = 'https://lsu-it-support-demo.herokuapp.com/'
*/
const PORT = process.env.PORT || 5000;
const HOST = process.env.HOST || `localhost:${PORT}`
export default axios.create({
baseURL: `http://localhost:3000/api/`,
baseURL: `http://${HOST}/api/`,
});

0 comments on commit 5d0e7ae

Please sign in to comment.