Permalink
Cannot retrieve contributors at this time
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?
6003CEM-CourseworkCodio/Readme.MD
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
53 lines (34 sloc)
1.21 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. | |
--- |