A weather server based on Vapor written by Swift
OS: macOS or Ubuntu
Database: MySQL
Framework: Vapor v1.0+
macOS
brew install mysql
brew link mysql
mysql.server start
Linux
sudo apt-get update
sudo apt-get install -y mysql-server libmysqlclient-dev
sudo mysql_install_db
sudo service mysql start
MySQL Script
source <project path>/Script/zweather_mysql_script.sql
cd <project path>/ZWeatherServer
macOS
swift build -Xswiftc -I/usr/local/include/mysql -Xlinker -L/usr/local/lib
Linux
swift build -Xswiftc -DNOJSON
For example:
- get city list: api/v1/get_city_list
- get current weather by city id: api/v1/get_current_weather?id=1796236