Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Commit

Permalink
refactor: Change the API to api/jobs
Browse files Browse the repository at this point in the history
- Add proxy to API server
  • Loading branch information
AjanShrestha committed Dec 22, 2019
1 parent 1b9d088 commit 733c1bc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ app.use(function(req, res, next) {
});

app.get('/', (req, res) => res.send('Jobs API!'));
app.get('/jobs', async (req, res) => {
app.get('/api/jobs', async (req, res) => {
const jobs = await getAsync('github');
return res.send(jobs);
});
Expand Down
3 changes: 2 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"eslintConfig": {
"extends": "react-app"
},
"proxy": "http://localhost:5000",
"browserslist": {
"production": [
">0.2%",
Expand All @@ -33,4 +34,4 @@
"last 1 safari version"
]
}
}
}
2 changes: 1 addition & 1 deletion client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import './App.css';

import Jobs from './Jobs';

const JOB_API_URL = 'http://localhost:5000/jobs';
const JOB_API_URL = '/api/jobs';

const fetchJobs = async updateCb => {
const res = await fetch(JOB_API_URL);
Expand Down

0 comments on commit 733c1bc

Please sign in to comment.