Skip to content

Commit

Permalink
fix: add api env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
korsun committed May 1, 2024
1 parent 88c0deb commit df85c57
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ OPENROUTESERVICE_API_KEY='5b3ce3597851110001cf62481766f58b063741c9977ec6ce848a72
GEOAPIFY_API_KEY='c9d16928a77b4f1185aff845ae4e73da'
THUNDERFOREST_API_KEY='7d9fefffc2984231af5a54c5e4ad0a83'
MAPTILER_API_KEY='ldgujGplx520Q0a3WG1f'

# API_BASE_URL='https://roamus-server.vercel.app'
API_BASE_URL='http://localhost:4000'
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ THUNDERFOREST_API_KEY=

# https://cloud.maptiler.com/maps
MAPTILER_API_KEY=

# https://roamus-server.vercel.app
API_BASE_URL='https://localhost:4000'
2 changes: 1 addition & 1 deletion client/src/api/fetchRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { apiService } from '@/services';

export const fetchRoute = async (payload: ProxyServerPayload) => {
return apiService.post({
url: 'http://localhost:4000/api/routing',
url: `${process.env.API_BASE_URL}/api/routing`,
payload,
});
};
8 changes: 3 additions & 5 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ app.get('/', (_, res) => {

app.use(errorHandler);

app.set('port', 4000);
const PORT = process.env.PORT || 4000;

app.listen(app.get('port'), () =>
app.listen(PORT, () =>
// eslint-disable-next-line no-console
console.log(
`${'\u001b[1;34m'}Server listening on port ${app.get('port')} πŸš€πŸš€πŸš€`,
),
console.log(`${'\u001b[1;34m'}Server listening on port ${PORT} πŸš€πŸš€πŸš€`),
);

0 comments on commit df85c57

Please sign in to comment.