Checkpoint 按照 Amazon 的要求验证传入的 Alexa 请求 - Amazon 文档
Package.swift
中添加.package(url: "https://github.com/vapor-community/checkpoint.git", from: "0.1.0")
并添加到依赖项
dependencies: ["Vapor", ..., "Checkpoint"]
import Checkpoint
...
let alexa = router.grouped(Checkpoint.self)
//Alexa.self would be your struct you use to decode the request send by Amazon to your service
//You would need to most likely return a json following the specifications Amazon set
alexa.post(Alexa.self, at: "alexa") { req, alexa -> String in
//do stuff with alexa and return the proper response
return "Hi Alexa!"
}
此项目基于 MIT 许可证 - 详见 LICENSE.md 文件