Initial commit
This commit is contained in:
13
backend/config/api.js
Normal file
13
backend/config/api.js
Normal file
@@ -0,0 +1,13 @@
|
||||
const weatherBaseUrl = "https://api.openweathermap.org/data/2.5";
|
||||
|
||||
const config = {
|
||||
weather: {
|
||||
baseUrl: weatherBaseUrl,
|
||||
apiKey: process.env.OPENWEATHER_API_KEY || "",
|
||||
city: process.env.WEATHER_CITY || "Seoul",
|
||||
units: process.env.WEATHER_UNITS || "metric",
|
||||
language: process.env.WEATHER_LANG || "en",
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
14
backend/config/db.js
Normal file
14
backend/config/db.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const mongoose = require("mongoose");
|
||||
|
||||
const connectDb = async () => {
|
||||
const mongoUri = process.env.MONGODB_URI;
|
||||
if (!mongoUri) {
|
||||
throw new Error("MONGODB_URI is not set");
|
||||
}
|
||||
|
||||
mongoose.set("strictQuery", true);
|
||||
await mongoose.connect(mongoUri);
|
||||
return mongoose.connection;
|
||||
};
|
||||
|
||||
module.exports = connectDb;
|
||||
Reference in New Issue
Block a user