This command-line utility fetches latitude, longitude, and location details for U.S. cities or zip codes using the OpenWeather Geocoding API. It supports input as either city/state combinations or zip codes, and allows multiple locations at once.
- Retrieve geolocation data (latitude, longitude, and place name) based on city/state or zip code.
- Supports multiple location inputs.
- Comprehensive QA testing including integration, performance, and rate-limiting tests.
- Node.js (v14.x or later)
- NPM (v6.x or later)
-
Clone the repository:
git clone https://github.com/PaladinKnightMaster/fetch-geoloc-qa-util.git cd fetch-geoloc-qa-util
-
Install dependencies:
npm install
-
Set up environment variables:
- Create a
.env
file in the root directory:touch .env
- Add your OpenWeather API key to the
.env
file:API_KEY=YOUR_OEPNWEATHER_API_KEY
- Create a
The utility supports two types of location input:
- City/State combination:
"Madison, WI"
- Zip code:
"12345"
Example usage:
node src/index.js "Madison, WI" "12345" "Chicago, IL"
The utility will output the latitude, longitude, and place name for each location.
We have set up integration, performance, and rate-limiting tests to ensure the utility works as expected.
- To run integration tests:
npm test
- Performance tests ensure response time is optimal (under 2 seconds):
npm run performance
This project uses GitHub Actions for Continuous Integration (CI) to automatically run tests on every push. The workflow is defined in .github/workflows/test.yml
.
/fetch-geoloc-qa-util
|-- src/
|-- index.js # Main script
|-- utils.js # Helper functions for fetching API data
|-- tests/
|-- integration.test.js # Integration tests
|-- performance.test.js # Performance tests
|-- .env # API key configuration (not included in repo)
|-- .gitignore # Ignoring node_modules, env, etc.
|-- package.json # Project dependencies and scripts
|-- README.md # Project documentation
|-- .github/
|-- workflows/
|-- test.yml # CI/CD config
- More comprehensive performance testing: Test with larger datasets.
- Expand unit testing: Add unit tests for error handling and edge cases.
- Additional rate-limiting tests: Extend to simulate production-level API calls.