/LearnSwiftMilan-EmojiPets

This project was part of a live coding session held at Learn Swift Milan meetup in November 2017

Primary LanguageSwiftMIT LicenseMIT

EmojiPets @ Learn Swift Milan

This project was part of a live coding session held at Learn Swift Milan meetup in November 2017, meant to illustrate the basics of Vapor.

It's a demo implementation of a very simple backend API for managing EmojiPet objects, as represented in JSON format as follows:

{
	"name": "FailPanda",
	"emoji": "🐼"
}

The project was created using Vapor v2.4.0.

How to Build & Run

  1. Install Vapor, as explained on its getting started page
  2. Build the project using vapor build
  3. Run the server with vapor run

If you want to generate an Xcode project, you can use the vapor xcode command.

How to Use

The REST API supports two endpoints:

  • GET /api/pets: get the list of existing EmojiPets
  • POST /api/pets: create a new EmojiPet

Extra

The project includes an emojipets.playground file, that shows how to decode a JSON response containing a list of EmojiPets using Swift 4's Codable.