Todos API using Vapor3 and Swift4
This repo is a part of my full-stack Swift tutorial:
- VaporTodos-API Vapor API (this repo)
- VaporTodos-iOS iOS Application
a. For Ubuntu
eval "$(curl -sL https://apt.vapor.sh)"
sudo apt-get install swift vapor
eval "$(curl -sL check.vapor.sh)"b. For macOS
brew install vaporvapor buildPlease be patient, this might take several minutes for the first build 😅
vapor xcode -yvapor run| Endpoint | Method | Description | Authorization Type |
|---|---|---|---|
api/auth/register |
POST |
Create new account | None |
api/auth/login |
POST |
Get access token | Basic |
api/users |
GET |
Get a list of users | Bearer |
api/users |
PUT |
Update current user info | Bearer |
api/todos |
POST |
Create new todo item | Bearer |
api/todos |
GET |
Get all user's todo items | Bearer |
api/todos/<id> |
GET |
Get todo item | Bearer |
api/todos/<id> |
PUT |
Update todo item | Bearer |
api/todos/<id> |
DELETE |
Delete todo item | Bearer |
- Models
PublicType.swiftprotocol used to create Public responses for models.Token.swiftToken model.User.swiftUser model.Todo.swiftTodo model.
- Controllers
AuthController.swifthandles creating users and logging in.TodoController.swifthandles CRUD operations on Todo items.UserController.swifthandles listing user's todo items.
Path.swiftURL pathes used in controllers.- Vapor Files automatically created by Vapor.
app.swiftboot.swiftconfigure.swiftroutes.swift
- Vapor 3
- Linux Ubuntu 14.04+ / macOS with Xcode 9.3+
- Swift 4+
VaporTodos is released under the MIT license. See LICENSE for more information.