A full-stack weather application built with Node.js backend and Vue 3 + Vite + Pinia frontend, providing weather forecasts for Chinese cities.
一个基于Node.js后端和Vue 3 + Vite + Pinia前端构建的全栈天气应用,提供中国城市的天气预报。
- Current weather conditions 当前天气状况
- 24-hour weather forecast 24小时天气预报
- 7-day weather forecast 7天天气预报
- Living indices (UV, humidity, etc.) 生活指数(紫外线、湿度等)
- City search 城市搜索
- Node.js (v16 or higher)
- npm (v8 or higher)
- API keys from QWeather (和风天气API密钥)
-
Navigate to the backend directory 进入后端目录:
cd Dawnight_back
-
Create a
config.env
file with the following content 创建config.env文件并添加以下内容:BASE_URL="https://api.qweather.com" PRIVATE_KEY="your_private_key" KEY_ID="your_key_id" PROJECT_ID="your_project_id"
-
Install dependencies 安装依赖:
npm install
-
Start the server 启动服务器:
npm dev
-
Navigate to the frontend directory 进入前端目录:
cd Dawnight
-
Install dependencies 安装依赖:
npm install
-
Start the development server 启动开发服务器:
npm run dev
-
Access the application at
http://localhost:5173
访问应用http://localhost:5173
-
Search for a Chinese city by click 通过点击输入中国城市名称
-
View current weather, hourly forecast, 7-day forecast, and living indices 查看当前天气、逐小时预报、7天预报和生活指数
This application uses QWeather API. To get your API keys: 本应用使用和风天气API。获取API密钥:
-
Register an account at QWeather Developer Platform 在和风天气开发者平台注册账号
-
Create a new project and obtain your KEY ID and Private Key 创建新项目并获取KEY ID和Private Key
-
Replace the placeholder values in
config.env
with your actual keys 用实际密钥替换config.env
中的占位符