Skip to content

Commit 4b7deed

Browse files
committed
chore: cleanup deployment configurations, keep only GitHub Pages setup
1 parent 45c395e commit 4b7deed

7 files changed

Lines changed: 8 additions & 144 deletions

File tree

api/weather.js

Lines changed: 0 additions & 37 deletions
This file was deleted.

deploy.sh

Lines changed: 0 additions & 23 deletions
This file was deleted.

netlify.toml

Lines changed: 0 additions & 12 deletions
This file was deleted.

netlify/functions/getWeather.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/App.jsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import SearchBar from './components/SearchBar';
44
import ErrorMessage from './components/ErrorMessage';
55
import WeatherCard from './components/WeatherCard';
66
import SetupInstructions from './components/SetupInstructions';
7-
import { API_BASE_URL } from './constants';
7+
import { API_KEY, API_BASE_URL } from './constants';
88

99
function App() {
1010
const [loading, setLoading] = useState(false);
@@ -23,13 +23,9 @@ function App() {
2323
setWeather(null);
2424

2525
try {
26-
const response = await fetch(API_BASE_URL, {
27-
method: 'POST',
28-
headers: {
29-
'Content-Type': 'application/json',
30-
},
31-
body: JSON.stringify({ city: query })
32-
});
26+
const response = await fetch(
27+
`${API_BASE_URL}/weather?q=${encodeURIComponent(query)}&appid=${API_KEY}&units=metric`
28+
);
3329

3430
if (!response.ok) {
3531
if (response.status === 404) {
@@ -76,7 +72,6 @@ function App() {
7672
</div>
7773
) : weather ? (
7874
<WeatherCard weather={weather} />
79-
) : null
8075
) : null}
8176
</main>
8277
</div>

src/constants.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Using serverless function to protect API key
2-
// API endpoint that will handle the weather request securely
3-
const API_BASE_URL = '/api/weather';
1+
// OpenWeather API configuration
2+
const API_KEY = import.meta.env.VITE_WEATHER_API_KEY;
3+
const API_BASE_URL = 'https://api.openweathermap.org/data/2.5';
44

55
const weatherBackgrounds = {
66
Clear: 'from-yellow-400 via-orange-400 to-red-400',
@@ -13,4 +13,4 @@ const weatherBackgrounds = {
1313
default: 'from-blue-400 via-blue-500 to-blue-600'
1414
};
1515

16-
export { API_BASE_URL, weatherBackgrounds };
16+
export { API_KEY, API_BASE_URL, weatherBackgrounds };

vercel.json

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)