Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lomirus/tencent-weather
tencent weather of mobile web version
https://github.com/lomirus/tencent-weather
imitation-learning weather-infomation
Last synced: 10 days ago
JSON representation
tencent weather of mobile web version
- Host: GitHub
- URL: https://github.com/lomirus/tencent-weather
- Owner: lomirus
- Created: 2021-05-29T14:32:04.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-03-27T14:54:28.000Z (over 2 years ago)
- Last Synced: 2024-10-25T09:27:37.701Z (about 2 months ago)
- Topics: imitation-learning, weather-infomation
- Language: TypeScript
- Homepage:
- Size: 2.14 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Introduction
This is an imatation of the [Tencent Weather](https://xw.tianqi.qq.com/) of mobile web version. Considering the high cost of weather API, here I just used koa to write a simple server which can respond with the mock data. You can get API documentions [here](#API).
## Preview
Loading Screen
Main Screen
## Features
### Client End
- `Webpack`
- Code Split
- `React`
- Functionnal Components, Hooks, React 17 JSX Tranform
- CSS in JS
- Flux (Hooks)
- `Typescript`
- `Babel`
- `ECharts`
- Progressive Web Application
- App Manifest
- Offline Cache### Server End
- `Koa 2`
- ~~Mock Data~~## Installation
```bash
git clone [email protected]:lomirus/tencent-weather.git
cd tencent-weather
npm install
```## Usage
```bash
npm run dev
# in another bash tab
npm run server
```Then open the link http://localhost:8080/ in your browser.
## API
### `/api/v1/weather`
APIs in this path will return the requested weather infomation, judging the client location by user's IP.
#### `/api/v1/weather/now`
Returns the real-time weather infomation.
Reponse Example:
```js
{
city: string, // "重庆市 南岸区"
temperature: number, // 20
weather: string, // "晴"
tip: string, // "光芒透过云缝,洒向大地~"
details: Array(2)>
/*[
["东北风", "1级"],
["湿度", "50%"]
]*/
}
```#### `/api/v1/weather/hours`
Returns the weather infomation of recent 24 hours.
Reponse Example:
```js
Array<{
time: string, // "15:00",
weather: string, // "yun",
temperature: number, // 20
}>(3)
```#### `/api/v1/weather/days`
Returns the weather infomation of recent days, which starts from yesterday, and is 7 days in total.
Reponse Example:
```js
Array<{
day: string, // "昨天", "今天", "周二"
date: string, // "05/28"
daytime_weather: string, // "阴"
daytime_icon: string, // "yin"
night_weather: string, // "阴"
night_icon: string, // "yin"
max_t: number, // 28
min_t: number, // 20
wind: string, // "东南风"
wind_speed: number, // 4
}>(24)
```#### `/api/v1/weather/suggestions`
Returns the suggestions, 8 ones in total in this version.
Reponse Example:
```js
Array<{
icon: string, // "t_shirt"
state: string, // "热"
for: string, // "穿衣"
}>(8)
```