dbystruev / Restaurant-Server-Vapor

Vapor 3 implementation of Restaurant Server for Apple App Development with Swift curriculum

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Restaurant Server Vapor

Tested on client

Prepare temporary docker container

# if running Docker on ARM (Mac M1) and getting error:
# docker: no matching manifest for linux/arm64/v8 in the manifest list entries
# use th089/swift instead of swift, i.e.
# docker run -p 8090:8090 -it --name Restaurant -w/Restaurant th089/swift bash
docker run -p 8090:8090 -it --name Restaurant -w/Restaurant swift bash

git clone https://github.com/dbystruev/Restaurant-Server-Vapor.git .
apt update && apt -y upgrade
apt -y install libssl-dev zlib1g-dev
swift build -c release
exit

Create docker image

docker commit Restaurant restaurant
docker rm Restaurant

Run new detached Restaurant container from restaurant image

docker run --name Restaurant -p8090:8090 -d restaurant swift run -c release

API

  • /categories — list of caregories
  • /menu?category=salads - meals in salads category
  • /menu — all meals in all categories
  • /order — post meals' IDs to get preparation time:
    curl \
        -X POST \
        -H "Content-Type: application/json" \
        -d '{"menuIds": [2, 1, 1, 4, 5]}' \
        mda.getoutfit.co:8090/order

About

Vapor 3 implementation of Restaurant Server for Apple App Development with Swift curriculum


Languages

Language:Swift 85.7%Language:Dockerfile 14.3%