This is a Node.js proxy server project designed to bypass CORS (Cross-Origin Resource Sharing) policy issues and facilitate access to the weather API. The main focus of the project is the back-end, using Express to set up the server and manage routes.
- Proxy Server: Forwards requests to the weather API, resolving CORS issues.
- Cache: Implemented caching with apicache to optimize request performance.
- Rate Limiting: Rate limiting with express-rate-limit to prevent abuse.
- CORS: Enabled CORS to allow cross-origin requests.
- Node.js
- Express
- apicache
- express-rate-limit
- dotenv
- needle
- cors
-
Clone the repository:
git clone https://github.com/your-username/your-repository.git
-
Navigate to the project directory:
cd your-repository
-
Install dependencies:
npm install
-
Create a
.env
file in the project root and add your environment variables:API_BASE_URL=your_api_base_url API_KEY_NAME=your_api_key_name API_KEY_VALUE=your_api_key_value PORT=your_port
-
Start the server:
npm start
GET /api
: Main route that forwards requests to the weather API.
public/
: Contains static files (HTML, CSS, JS).routes/
: Contains route definitions for the proxy server.index.js
: Main server file.package.json
: List of dependencies and project scripts.
Contributions are welcome! Feel free to open issues and pull requests.
This project is licensed under the MIT License.