Skip to content

Commit 5a4f2ec

Browse files
authored
v1.0
* major change - replace teleport API with Algolia Places API and refactor the code * update react-scripts and fix root directory URL for loading assets on prod & dev environment * update logic to cover all the edge cases regarding Algolia Places API response * update env variables * fix favorite component duplicate keys issue * update aroundLatLong param in city autocomplete component * improve autocomplete search recommendations
1 parent 9194d0d commit 5a4f2ec

File tree

17 files changed

+2521
-4299
lines changed

17 files changed

+2521
-4299
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ node_modules
1818
.env.development.local
1919
.env.test.local
2020
.env.production.local
21+
/server/.env
2122

2223
npm-debug.log*
2324
yarn-debug.log*
2425
yarn-error.log*
25-
26-
DATA.md

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,17 @@ git clone -b local-setup https://github.com/iamsainikhil/weather-react.git
4444

4545
- Create a `.env` file in the root directory of the project. Add the following properties in it:
4646

47-
```bash
47+
```bash
4848

49-
REACT_APP_DARKSKY_API_KEY=<your Dark Sky API Key>
49+
REACT_APP_DARKSKY_API_KEY=<your Dark Sky API Key>
5050

51-
```
51+
REACT_APP_ALGOLIA_PLACES_APP_ID=<your Algolia Places APP ID> (Optional)
52+
53+
REACT_APP_ALGOLIA_PLACES_API_KEY=<your Algolia Places Search-Only API Key> (Optional)
54+
55+
```
56+
57+
_You can obtain your Algolia Places API key **[here](https://community.algolia.com/places/pricing.html)**. You will get higher rate limits if you sign up and provide an api key OR it's just limited to **1000** requests/day! Moreover, code logic handles the scenario where no Algolia App ID & API key are provided.\*_
5258

5359
_That's it! You can run the below available scripts to get up and running on the localhost. If you want to dive deeper into the codebase, I recommend you to check the architecture documentation to customize this application as your wish._
5460

@@ -138,6 +144,10 @@ There are so many weather-related applications out in the wild. So, the goal is
138144

139145
- Dark Sky API needs a proxy server to send and receive a response which was easy in the development stage using a browser extension like **[this](https://chrome.google.com/webstore/detail/moesif-orign-cors-changer/digfbfaphojjndkpccljibejjbppifbc)** to enable CORS in the browser. However, I can't ask every user to install this extension in their browser to check the weather forecast. So, I overcome this issue temporarily for now using the `cors-anywhere` library which you can get more info by checking **[here](https://github.com/Rob--W/cors-anywhere)**.
140146

147+
- Latest challenge I encountered is that **Teleport** API is permanantly shutdown and this led to broken autocomplete city search, and photos for favorited cities. Moreover, there is a tight coupling of code logic with this API. Now, I made a well thought highly scalable solution of using **Algolia Places** Rest API for fetching address based on city query as well as fetching city name based on latitude and longitude. I am very much about this change since it removed a lot of bad code and improved the application load times and performance.
148+
149+
_Note: The application UI/UX is not affected with this API change._
150+
141151
## 📖 Architecture
142152

143153
![Weather React Application Architecture](./Weather_React_Architecture.svg)

0 commit comments

Comments
 (0)