This project is a basic web server that exposes an API endpoint for the Stage One Task of the Backend Track. It provides information about the client's IP address, location, and current temperature.
- Retrieves the client's IP address
- Determines the client's location (city) based on their IP
- Fetches the current temperature for the client's city
- Responds with a personalized greeting including the visitor's name and temperature information
GET /api/hello?visitor_name=
{
"client_ip": "127.0.0.1",
"location": "New York",
"greeting": "Hello, Mark!, the temperature is 11 degrees Celsius in New York"
}Before you begin, ensure you have the following installed:
- Node.js and npm: Download and install from nodejs.org
- Clone the repository
- Install dependencies:
npm install
- Create a
.envfile in the project root directory - Add the following environment variables:
APP_NAME=YourAppName APP_PORT=3000 APP_ENV=development OPEN_WEATHER_API_KEY=your_api_key_here
Replace YourAppName and your_api_key_here with your actual project name and OpenWeather API key.
Start the development server:
npm run devThe server will be running at http://localhost:3000.
This project can be deployed to any free hosting platform that supports Node.js applications.
- Express.js
- Axios for API requests
- GeoIP-lite for IP geo location
- Winston for logging