Tag: 游戏中时光倒流

Raspberry Pi时间流逝,带有Swift,Vapor,Docker和Nginx的Ubuntu 16.04服务器

为了使这个基本任务复杂化并学到一些有趣的东西,可以使用Docker并在容器中运行我们的服务器。 有很多关于Docker的教程(我建议您查阅https://www.digitalocean.com教程),因此我将只关注与我的项目相关的部分。 我遵循了本教程:https://bygri.github.io/2018/05/14/developing-deploying-vapor-docker.html 因为服务器代码非常简单,所以我没有使用单独的开发/生产设置和docker-compose。 要启动蒸气项目: 蒸发新的上传图像 我从模板中剥离了所有不必要的代码(删除了数据库依赖项),并将route.swift减少为: 进口蒸气 结构图片:内容{ var image:文件 } 公共 功能路由( _路由器:路由器) 抛出 { router.post(“ image”){ req-> Future 在 返回 尝试 req.content.decode(Image.self).map(to:HTTPStatus.self){fileImage in 让 imageFolder =“ / app / Public” 让 fileName = fileImage.image.filename 让 url = URL(fileURLWithPath:imageFolder).appendingPathComponent(fileName) 做 { 尝试 fileImage.image.data.write(to:url) } { 返回 .badRequest } 返回 .ok } } } […]