Swift Vapor Todo CRUD API using MySQL to store data. It Provides app engine app.yaml configuration file and Dockerfile to deploy the app to Google App Engine Flexible Custom Runtime.
- list of todos (GET /todo/)
- list of single todos (GET /todo/id)
- create todo (POST /todo) -> JSON { title: String, content: String, dueDate: ISO8601 Formatted String}
- update todo (PUT /todo) -> JSON { id: number, title: String, content: String, dueDate: ISO8601 Formatted String}
- Clone the app to your local machine
- Install MySQL locally
- Create MySQL user and password, create database called todo
- Set Environment Variable for MySQL located in routes.swift in your local environment
- Build and Run the app locally
- Test CRUD using CURL
- Clone the app to your local machine.
- Install Google Cloud SDK and authenticate in your local machine using your Google Cloud Account.
- Create Cloud SQL instance in Google Cloud Console. Create user, password, and new database called todo. Set public IP Access to 0.0.0.0/0 (Warning: Currently Vapor 3 does not support connecting to MySQL using Unix Socket for Cloud SQL Proxy and SSL Client Certificate configuration. For testing purpose we just use this method until vapor officially supports it).
- Open app.yaml and update the environment variable for MySQL username, ip address, password, database, and cloud sql instance name
- type gcloud app deploy to deploy.
- type gcloud app browse to view the app address
- Make sure to disable the application from the App Engine Console and stop the Cloud SQL instance to avoid billing when testing.