Coder Social home page Coder Social logo

alfianlosari / appengineflex-swift-vapor Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 1.0 86 KB

App Engine Flex Custom Runtime Running Swift and Vapor

License: MIT License

Dockerfile 7.66% Swift 92.34%
swift vapor-swift api appengine google-cloud docker vapor backend

appengineflex-swift-vapor's Introduction

App Engine Flexible Docker Runtime with Swift and Vapor

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.

API Specification

  • 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}

Try it out Locally

  1. Clone the app to your local machine
  2. Install MySQL locally
  3. Create MySQL user and password, create database called todo
  4. Set Environment Variable for MySQL located in routes.swift in your local environment
  5. Build and Run the app locally
  6. Test CRUD using CURL

Deploying to App Engine

  1. Clone the app to your local machine.
  2. Install Google Cloud SDK and authenticate in your local machine using your Google Cloud Account.
  3. 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).
  4. Open app.yaml and update the environment variable for MySQL username, ip address, password, database, and cloud sql instance name
  5. type gcloud app deploy to deploy.
  6. type gcloud app browse to view the app address
  7. Make sure to disable the application from the App Engine Console and stop the Cloud SQL instance to avoid billing when testing.

appengineflex-swift-vapor's People

Contributors

alfianlosari avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

dalalsunil1986

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.