First install dependencies:
npm install
-
Create MongoDB Database:
- Make sure MongoDB is installed and running.
- Create a database named
weather
. - Optionally, create a collection named
test
within theweather
database.
-
Create
.env
File:- Create a
.env
file in the root directory of your project. - Add the following configuration to the
.env
file:
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. - Create a
To start the server, run:
npm run start
The server will start at http://localhost:3000
.
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.