Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
# Weather API
## Installation
First install dependencies:
```bash
npm install
```
## Setting Up MongoDB
1. **Create MongoDB Database:**
- Make sure MongoDB is installed and running.
- Create a database named `weather`.
- Optionally, create a collection named `test` within the `weather` database.
2. **Create `.env` File:**
- Create a `.env` file in the root directory of your project.
- Add the following configuration to the `.env` file:
```dotenv
OPENWEATHERMAP_API_KEY=b31583c910d30e7cd9b162d25e1d3793
MONGO_URI=mongodb://localhost:27017/weather
# Make a database in MongoDB called weather and add the collection called test if needed
# Add the connection string to the .env file
```
Replace `b31583c910d30e7cd9b162d25e1d3793` with your actual OpenWeatherMap API key.
## Running the Server
To start the server, run:
```bash
npm run start
```
The server will start at `http://localhost:3000`.
## API Documentation
After starting the server, access the API documentation at:
```
http://localhost:3000/docs
```
This documentation is generated using Swagger UI and provides details on the available endpoints and how to use them.
---