Skip to content

A simple API for retrieving weather data for a given city.

License

Notifications You must be signed in to change notification settings

derungo/weatherAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weather API

A simple API for retrieving weather data for a given city.

Endpoints GET /v1/weather/:city Retrieves the current weather data for a specific city. Requires the city parameter in the URL path. Returns a JSON object with the weather data. GET /v1/weather/:city/forecast Retrieves the weather forecast for a specific city. Requires the city parameter in the URL path. Returns a JSON object with the forecast data.

Error Handling The API uses a custom error handler middleware to catch and handle errors. Errors are returned in the response with a JSON object containing the error code and message.

Environment Variables WEATHER_API_KEY: The API key for the OpenWeatherMap API.

Dependencies express: The web framework for building the API. axios: The HTTP client for making requests to the OpenWeatherMap API. dotenv: The package for loading environment variables from a .env file.

Usage Clone the repository and install the dependencies with npm install. Create a .env file with your OpenWeatherMap API key: WEATHER_API_KEY=YOUR_API_KEY. Start the server with node server.js. Make requests to the API endpoints to retrieve weather data.

License

MIT

About

A simple API for retrieving weather data for a given city.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published