构建 REST API

Building an REST API

我正在开展一个项目,希望从头开始构建 REST API。所以我最初的想法是利用一种相对较新的 aysnc 非阻塞 I/O 框架。

我一直在研究 Typesafe 框架(Scala、Akka、Play)。 这对 RESTful API 是一个好的解决方案吗?

有什么好的(最新的)tutorials/examples人们可以提供链接吗?

另外,我遇​​到了spray.io。据我所知,如果我只想构建一个 REASTful API,这似乎是使用 Play 的一个很好的替代方案? 真的吗? 有什么好的教程吗?

我真的很想从一开始就使用 Akka 及其 Actors 模型。

另外,我读到 Typesafe 收购了 spray.io 以将其集成到 Typesafe 框架中。 这已经完成了吗?如果我下载最新版本的 Typesafe,我会得到捆绑的喷雾吗?

最后,托管。对于使用此类框架托管这样的 API,人们会提出什么建议? AWS、Google、Cloud Foundry、Heroku? 该服务最终需要具有极高的可扩展性。

有谁知道涵盖以上大部分内容的任何好链接?例如,在 Cloud Foundry 上部署基于 API 的喷雾?

感谢您的帮助。

您的问题过于宽泛,容易出现基于意见的答案。无论如何,我的两分钱:

I've been looking at the Typesafe framework (Scala, Akka, Play). Is this a good solution for a RESTful API?

恕我直言,如果你既想发展你的系统又想安然入睡,这是当前最好的解决方案。

Are there any good (up to date) tutorials/examples that people could provide links to?

到处都是。检查以下内容,例如:

http://akka.io/docs/(Akka 官方文档,我觉得很棒) https://typesafe.com/activator/templates(几乎所有您想要 learn/do 的模板,包括 Akka、Play、Spray 等等) https://www.playframework.com/documentation/2.3.x/Home(官方 Play 文档,以备不时之需)

Also, I came across spray.io. From what I can gather this seems to be a good alternative to using Play if all I want to build is a REASTful API? Is that true? Any good tutorials for this?

如果您只计划 RESTful API,是的,这似乎是个不错的选择。有关教程,请参阅官方 site 和上面列出的激活器模板。

Separately I read that Typesafe acquired spray.io to integrate it into the Typesafe framework. Has this been done yet? If I download the latest version of Typesafe do I get spray bundled in with it?

据我了解,Akka 正在基于 spray.io 团队的工作实现自己的 http 模块。有关详细信息,请参阅 here。 Play 最终将建立在 Akka 流和 http 模块之上。它仍然被标记为实验性的,并且该过程仍在进行中。您只需添加依赖项即可在项目中使用 spray。没有 "latest version of Typesafe" 这样的东西,除非您谈论的是 Typesafe Activator,它是由 Typesafe 提供的工具包(包括 Play 和 Akka 以及一些不错的 Web 界面)。通常,您需要的内容会自动下载。有关详细信息,请参阅示例。

Finally, hosting. What would people suggest for hosting such an API with this type of framework? AWS, Google, Cloud Foundry, Heroku?

不知道。到目前为止,我一直在成功使用 AWS,但由于我没有尝试过其他选项,因此我无法对此发表意见。

Does anyone know of any good links that cover a lot of the above? i.e. deploying a spray based API on Cloud Foundry for example?

具体到 Cloud Foundry,我不知道。

希望对您有所帮助!

P.S.: 你的问题太笼统了。尝试在未来提出真实的具体问题以及您尝试(未成功)解决它。